@kingstinct/react-native-healthkit 12.1.2 → 12.2.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 (266) hide show
  1. package/ios/CategoryTypeModule.swift +49 -97
  2. package/ios/CharacteristicTypeModule.swift +77 -63
  3. package/ios/CoreModule.swift +324 -280
  4. package/ios/CorrelationTypeModule.swift +192 -144
  5. package/ios/ElectrocardiogramModule.swift +185 -194
  6. package/ios/HeartbeatSeriesModule.swift +123 -171
  7. package/ios/Helpers.swift +312 -571
  8. package/ios/MedicationModule.swift +259 -0
  9. package/ios/PredicateHelpers.swift +334 -0
  10. package/ios/QuantityTypeModule.swift +297 -378
  11. package/ios/Serializers.swift +273 -210
  12. package/ios/SourceProxy.swift +2 -2
  13. package/ios/StateOfMindModule.swift +179 -125
  14. package/ios/WorkoutProxy.swift +235 -112
  15. package/ios/WorkoutsModule.swift +214 -262
  16. package/lib/commonjs/healthkit.ios.js +22 -2
  17. package/lib/commonjs/healthkit.js +35 -5
  18. package/lib/commonjs/hooks/useStatisticsForQuantity.js +1 -1
  19. package/lib/commonjs/hooks/useSubscribeToCategorySamples.js +20 -0
  20. package/lib/commonjs/modules.js +2 -1
  21. package/lib/commonjs/specs/MedicationModule.nitro.js +27 -0
  22. package/lib/commonjs/types/Constants.js +2 -1
  23. package/lib/commonjs/types/QuantityType.js +8 -1
  24. package/lib/commonjs/types/QueryOptions.js +18 -0
  25. package/lib/commonjs/types/WeatherCondition.js +32 -32
  26. package/lib/commonjs/types/Workouts.js +1 -50
  27. package/lib/commonjs/utils/getCategorySampleById.js +1 -1
  28. package/lib/commonjs/utils/getQuantitySampleById.js +1 -1
  29. package/lib/commonjs/utils/getWorkoutById.js +1 -1
  30. package/lib/commonjs/utils/subscribeToCategorySamples.js +29 -0
  31. package/lib/commonjs/utils/subscribeToQuantitySamples.js +8 -25
  32. package/lib/module/healthkit.ios.js +20 -2
  33. package/lib/module/healthkit.js +32 -2
  34. package/lib/module/hooks/useStatisticsForQuantity.js +1 -1
  35. package/lib/module/hooks/useSubscribeToCategorySamples.js +17 -0
  36. package/lib/module/modules.js +1 -0
  37. package/lib/module/specs/MedicationModule.nitro.js +26 -0
  38. package/lib/module/types/Constants.js +1 -0
  39. package/lib/module/types/QuantityType.js +7 -0
  40. package/lib/module/types/QueryOptions.js +17 -1
  41. package/lib/module/types/WeatherCondition.js +31 -31
  42. package/lib/module/types/Workouts.js +0 -49
  43. package/lib/module/utils/getCategorySampleById.js +1 -1
  44. package/lib/module/utils/getQuantitySampleById.js +1 -1
  45. package/lib/module/utils/getWorkoutById.js +1 -1
  46. package/lib/module/utils/subscribeToCategorySamples.js +26 -0
  47. package/lib/module/utils/subscribeToQuantitySamples.js +8 -25
  48. package/lib/typescript/healthkit.d.ts +18 -9
  49. package/lib/typescript/healthkit.ios.d.ts +33 -15
  50. package/lib/typescript/hooks/useSubscribeToCategorySamples.d.ts +3 -0
  51. package/lib/typescript/modules.d.ts +2 -0
  52. package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +2 -2
  53. package/lib/typescript/specs/CoreModule.nitro.d.ts +2 -1
  54. package/lib/typescript/specs/CorrelationTypeModule.nitro.d.ts +4 -2
  55. package/lib/typescript/specs/ElectrocardiogramModule.nitro.d.ts +1 -1
  56. package/lib/typescript/specs/HeartbeatSeriesModule.nitro.d.ts +1 -1
  57. package/lib/typescript/specs/MedicationModule.nitro.d.ts +56 -0
  58. package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +4 -4
  59. package/lib/typescript/specs/StateOfMindModule.nitro.d.ts +4 -3
  60. package/lib/typescript/types/CategoryType.d.ts +10 -20
  61. package/lib/typescript/types/Constants.d.ts +1 -0
  62. package/lib/typescript/types/CorrelationType.d.ts +8 -10
  63. package/lib/typescript/types/ElectrocardiogramSample.d.ts +2 -12
  64. package/lib/typescript/types/HeartbeatSeries.d.ts +2 -14
  65. package/lib/typescript/types/QuantitySample.d.ts +2 -8
  66. package/lib/typescript/types/QuantityType.d.ts +7 -8
  67. package/lib/typescript/types/QuantityTypeIdentifier.d.ts +23 -23
  68. package/lib/typescript/types/QueryOptions.d.ts +43 -28
  69. package/lib/typescript/types/Shared.d.ts +52 -7
  70. package/lib/typescript/types/StateOfMind.d.ts +7 -10
  71. package/lib/typescript/types/Subscriptions.d.ts +12 -3
  72. package/lib/typescript/types/WeatherCondition.d.ts +1 -1
  73. package/lib/typescript/types/Workouts.d.ts +28 -81
  74. package/lib/typescript/utils/subscribeToCategorySamples.d.ts +5 -0
  75. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +57 -0
  76. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +592 -389
  77. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +65 -30
  78. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +8 -0
  79. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +15 -0
  80. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +32 -26
  81. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +36 -37
  82. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +55 -2
  83. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +36 -30
  84. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +35 -29
  85. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.cpp +11 -0
  86. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +181 -0
  87. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +48 -42
  88. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +59 -36
  89. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +150 -29
  90. package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +13 -28
  91. package/nitrogen/generated/ios/swift/AggregationStyle.swift +48 -0
  92. package/nitrogen/generated/ios/swift/CategorySample.swift +571 -24
  93. package/nitrogen/generated/ios/swift/ComparisonPredicateOperator.swift +2 -2
  94. package/nitrogen/generated/ios/swift/CorrelationSample.swift +640 -17
  95. package/nitrogen/generated/ios/swift/{PredicateWithStartAndEnd.swift → DateFilter.swift} +5 -5
  96. package/nitrogen/generated/ios/swift/ECGQueryOptionsWithAnchor.swift +11 -91
  97. package/nitrogen/generated/ios/swift/ECGQueryOptionsWithSortOrder.swift +11 -91
  98. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +570 -72
  99. package/nitrogen/generated/ios/swift/FilterForSamples.swift +349 -12
  100. package/nitrogen/generated/ios/swift/FilterForSamplesBase.swift +234 -0
  101. package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +366 -0
  102. package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +240 -0
  103. package/nitrogen/generated/ios/swift/Func_void_MedicationDoseEventsWithAnchorResponse.swift +47 -0
  104. package/nitrogen/generated/ios/swift/Func_void_QueryCorrelationSamplesWithAnchorResponse.swift +47 -0
  105. package/nitrogen/generated/ios/swift/Func_void_StateOfMindSamplesWithAnchorResponse.swift +47 -0
  106. package/nitrogen/generated/ios/swift/Func_void_std__vector_MedicationDoseEvent_.swift +47 -0
  107. package/nitrogen/generated/ios/swift/Func_void_std__vector_UserAnnotatedMedication_.swift +47 -0
  108. package/nitrogen/generated/ios/swift/GeneralForm.swift +104 -0
  109. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +44 -0
  110. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +565 -37
  111. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
  112. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +2 -2
  113. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -1
  114. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +19 -31
  115. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +2 -1
  116. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +21 -2
  117. package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec.swift +1 -1
  118. package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec_cxx.swift +2 -2
  119. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +1 -1
  120. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +2 -2
  121. package/nitrogen/generated/ios/swift/HybridMedicationModuleSpec.swift +60 -0
  122. package/nitrogen/generated/ios/swift/HybridMedicationModuleSpec_cxx.swift +208 -0
  123. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +2 -2
  124. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +9 -43
  125. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +2 -1
  126. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +21 -2
  127. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +34 -6
  128. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +376 -36
  129. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +40 -0
  130. package/nitrogen/generated/ios/swift/MedicationConcept.swift +80 -0
  131. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +781 -0
  132. package/nitrogen/generated/ios/swift/MedicationDoseEventLogStatus.swift +56 -0
  133. package/nitrogen/generated/ios/swift/MedicationDoseEventScheduleType.swift +40 -0
  134. package/nitrogen/generated/ios/swift/MedicationDoseEventsWithAnchorResponse.swift +81 -0
  135. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +16 -16
  136. package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +7 -7
  137. package/nitrogen/generated/ios/swift/QuantitySample.swift +574 -27
  138. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +16 -16
  139. package/nitrogen/generated/ios/swift/QueryCorrelationSamplesWithAnchorResponse.swift +81 -0
  140. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +11 -91
  141. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +11 -91
  142. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +11 -91
  143. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +11 -91
  144. package/nitrogen/generated/ios/swift/RelatedCoding.swift +76 -0
  145. package/nitrogen/generated/ios/swift/SampleType.swift +68 -0
  146. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +16 -16
  147. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +0 -16
  148. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +586 -58
  149. package/nitrogen/generated/ios/swift/StateOfMindSamplesWithAnchorResponse.swift +81 -0
  150. package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +7 -75
  151. package/nitrogen/generated/ios/swift/UserAnnotatedMedication.swift +87 -0
  152. package/nitrogen/generated/ios/swift/WeatherCondition.swift +144 -0
  153. package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +11 -105
  154. package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +11 -105
  155. package/nitrogen/generated/ios/swift/WorkoutSample.swift +751 -78
  156. package/nitrogen/generated/shared/c++/AggregationStyle.hpp +64 -0
  157. package/nitrogen/generated/shared/c++/CategorySample.hpp +126 -23
  158. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +134 -12
  159. package/nitrogen/generated/shared/c++/{PredicateWithStartAndEnd.hpp → DateFilter.hpp} +10 -10
  160. package/nitrogen/generated/shared/c++/ECGQueryOptionsWithAnchor.hpp +12 -31
  161. package/nitrogen/generated/shared/c++/ECGQueryOptionsWithSortOrder.hpp +12 -31
  162. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +135 -36
  163. package/nitrogen/generated/shared/c++/FilterForSamples.hpp +124 -0
  164. package/nitrogen/generated/shared/c++/FilterForSamplesBase.hpp +109 -0
  165. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +131 -0
  166. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +116 -0
  167. package/nitrogen/generated/shared/c++/GeneralForm.hpp +140 -0
  168. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +67 -0
  169. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +131 -28
  170. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +1 -2
  171. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +1 -0
  172. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +10 -28
  173. package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.cpp +1 -0
  174. package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +11 -1
  175. package/nitrogen/generated/shared/c++/HybridElectrocardiogramModuleSpec.hpp +1 -2
  176. package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +1 -2
  177. package/nitrogen/generated/shared/c++/HybridMedicationModuleSpec.cpp +24 -0
  178. package/nitrogen/generated/shared/c++/HybridMedicationModuleSpec.hpp +80 -0
  179. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.cpp +1 -1
  180. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +6 -25
  181. package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.cpp +1 -0
  182. package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +9 -2
  183. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +33 -5
  184. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +56 -16
  185. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +62 -0
  186. package/nitrogen/generated/shared/c++/MedicationConcept.hpp +93 -0
  187. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +240 -0
  188. package/nitrogen/generated/shared/c++/MedicationDoseEventLogStatus.hpp +66 -0
  189. package/nitrogen/generated/shared/c++/MedicationDoseEventScheduleType.hpp +62 -0
  190. package/nitrogen/generated/shared/c++/MedicationDoseEventsWithAnchorResponse.hpp +89 -0
  191. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +105 -105
  192. package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +8 -8
  193. package/nitrogen/generated/shared/c++/QuantitySample.hpp +130 -27
  194. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +105 -105
  195. package/nitrogen/generated/shared/c++/QueryCorrelationSamplesWithAnchorResponse.hpp +89 -0
  196. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +12 -31
  197. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +12 -31
  198. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +12 -31
  199. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +12 -31
  200. package/nitrogen/generated/shared/c++/RelatedCoding.hpp +84 -0
  201. package/nitrogen/generated/shared/c++/SampleType.hpp +87 -0
  202. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +105 -105
  203. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +105 -121
  204. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +139 -36
  205. package/nitrogen/generated/shared/c++/StateOfMindSamplesWithAnchorResponse.hpp +89 -0
  206. package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +8 -27
  207. package/nitrogen/generated/shared/c++/UserAnnotatedMedication.hpp +90 -0
  208. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +88 -0
  209. package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +12 -37
  210. package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +12 -37
  211. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +159 -35
  212. package/package.json +1 -1
  213. package/src/healthkit.ios.ts +30 -0
  214. package/src/healthkit.ts +68 -3
  215. package/src/hooks/useStatisticsForQuantity.ts +1 -1
  216. package/src/hooks/useSubscribeToCategorySamples.ts +31 -0
  217. package/src/modules.ts +4 -0
  218. package/src/specs/CategoryTypeModule.nitro.ts +2 -2
  219. package/src/specs/CoreModule.nitro.ts +3 -0
  220. package/src/specs/CorrelationTypeModule.nitro.ts +11 -3
  221. package/src/specs/ElectrocardiogramModule.nitro.ts +1 -1
  222. package/src/specs/HeartbeatSeriesModule.nitro.ts +1 -1
  223. package/src/specs/MedicationModule.nitro.ts +140 -0
  224. package/src/specs/QuantityTypeModule.nitro.ts +4 -7
  225. package/src/specs/StateOfMindModule.nitro.ts +10 -2
  226. package/src/types/CategoryType.ts +15 -22
  227. package/src/types/Constants.ts +3 -0
  228. package/src/types/CorrelationType.ts +10 -15
  229. package/src/types/ElectrocardiogramSample.ts +2 -14
  230. package/src/types/HeartbeatSeries.ts +2 -15
  231. package/src/types/QuantitySample.ts +2 -8
  232. package/src/types/QuantityType.ts +8 -17
  233. package/src/types/QuantityTypeIdentifier.ts +25 -25
  234. package/src/types/QueryOptions.ts +54 -43
  235. package/src/types/Shared.ts +74 -17
  236. package/src/types/StateOfMind.ts +8 -10
  237. package/src/types/Subscriptions.ts +19 -3
  238. package/src/types/WeatherCondition.ts +1 -1
  239. package/src/types/Workouts.ts +28 -91
  240. package/src/utils/getCategorySampleById.ts +1 -1
  241. package/src/utils/getQuantitySampleById.ts +1 -1
  242. package/src/utils/getWorkoutById.ts +1 -2
  243. package/src/utils/subscribeToCategorySamples.ts +38 -0
  244. package/src/utils/subscribeToQuantitySamples.ts +12 -37
  245. package/nitrogen/generated/ios/swift/FilterForSamplesAnd.swift +0 -94
  246. package/nitrogen/generated/ios/swift/FilterForSamplesOr.swift +0 -94
  247. package/nitrogen/generated/ios/swift/PredicateForSamples.swift +0 -21
  248. package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +0 -23
  249. package/nitrogen/generated/ios/swift/PredicateForWorkoutsAnd.swift +0 -108
  250. package/nitrogen/generated/ios/swift/PredicateForWorkoutsOr.swift +0 -108
  251. package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +0 -45
  252. package/nitrogen/generated/ios/swift/PredicateWithMetadataOperator.swift +0 -48
  253. package/nitrogen/generated/ios/swift/PredicateWithUUID.swift +0 -35
  254. package/nitrogen/generated/ios/swift/PredicateWithUUIDs.swift +0 -47
  255. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +0 -23
  256. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +0 -25
  257. package/nitrogen/generated/ios/swift/WorkoutActivityTypePredicate.swift +0 -35
  258. package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +0 -90
  259. package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +0 -90
  260. package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +0 -96
  261. package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +0 -96
  262. package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +0 -77
  263. package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +0 -84
  264. package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +0 -75
  265. package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +0 -76
  266. package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +0 -76
@@ -23,21 +23,36 @@
23
23
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
24
  #endif
25
25
 
26
- // Forward declaration of `Device` to properly resolve imports.
27
- namespace margelo::nitro::healthkit { struct Device; }
28
26
  // Forward declaration of `Heartbeat` to properly resolve imports.
29
27
  namespace margelo::nitro::healthkit { struct Heartbeat; }
28
+ // Forward declaration of `SampleType` to properly resolve imports.
29
+ namespace margelo::nitro::healthkit { struct SampleType; }
30
+ // Forward declaration of `WeatherCondition` to properly resolve imports.
31
+ namespace margelo::nitro::healthkit { enum class WeatherCondition; }
32
+ // Forward declaration of `Quantity` to properly resolve imports.
33
+ namespace margelo::nitro::healthkit { struct Quantity; }
34
+ // Forward declaration of `InsulinDeliveryReason` to properly resolve imports.
35
+ namespace margelo::nitro::healthkit { enum class InsulinDeliveryReason; }
36
+ // Forward declaration of `HeartRateMotionContext` to properly resolve imports.
37
+ namespace margelo::nitro::healthkit { enum class HeartRateMotionContext; }
30
38
  // Forward declaration of `SourceRevision` to properly resolve imports.
31
39
  namespace margelo::nitro::healthkit { struct SourceRevision; }
40
+ // Forward declaration of `Device` to properly resolve imports.
41
+ namespace margelo::nitro::healthkit { struct Device; }
32
42
 
33
- #include <string>
34
- #include "Device.hpp"
35
- #include <optional>
36
- #include <chrono>
37
43
  #include "Heartbeat.hpp"
38
44
  #include <vector>
39
- #include <NitroModules/AnyMap.hpp>
45
+ #include "SampleType.hpp"
46
+ #include <chrono>
47
+ #include "WeatherCondition.hpp"
48
+ #include <optional>
49
+ #include "Quantity.hpp"
50
+ #include "InsulinDeliveryReason.hpp"
51
+ #include "HeartRateMotionContext.hpp"
52
+ #include <string>
40
53
  #include "SourceRevision.hpp"
54
+ #include "Device.hpp"
55
+ #include <NitroModules/AnyMap.hpp>
41
56
 
42
57
  namespace margelo::nitro::healthkit {
43
58
 
@@ -46,17 +61,39 @@ namespace margelo::nitro::healthkit {
46
61
  */
47
62
  struct HeartbeatSeriesSample {
48
63
  public:
49
- std::string uuid SWIFT_PRIVATE;
50
- std::optional<Device> device SWIFT_PRIVATE;
64
+ std::vector<Heartbeat> heartbeats SWIFT_PRIVATE;
65
+ SampleType sampleType SWIFT_PRIVATE;
51
66
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
52
67
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
53
- std::vector<Heartbeat> heartbeats SWIFT_PRIVATE;
54
- std::optional<std::shared_ptr<AnyMap>> metadata SWIFT_PRIVATE;
55
- std::optional<SourceRevision> sourceRevision SWIFT_PRIVATE;
68
+ bool hasUndeterminedDuration SWIFT_PRIVATE;
69
+ std::optional<WeatherCondition> metadataWeatherCondition SWIFT_PRIVATE;
70
+ std::optional<Quantity> metadataWeatherHumidity SWIFT_PRIVATE;
71
+ std::optional<Quantity> metadataWeatherTemperature SWIFT_PRIVATE;
72
+ std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason SWIFT_PRIVATE;
73
+ std::optional<HeartRateMotionContext> metadataHeartRateMotionContext SWIFT_PRIVATE;
74
+ std::string uuid SWIFT_PRIVATE;
75
+ SourceRevision sourceRevision SWIFT_PRIVATE;
76
+ std::optional<Device> device SWIFT_PRIVATE;
77
+ std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
78
+ std::optional<std::string> metadataExternalUUID SWIFT_PRIVATE;
79
+ std::optional<std::string> metadataTimeZone SWIFT_PRIVATE;
80
+ std::optional<bool> metadataWasUserEntered SWIFT_PRIVATE;
81
+ std::optional<std::string> metadataDeviceSerialNumber SWIFT_PRIVATE;
82
+ std::optional<std::string> metadataUdiDeviceIdentifier SWIFT_PRIVATE;
83
+ std::optional<std::string> metadataUdiProductionIdentifier SWIFT_PRIVATE;
84
+ std::optional<std::string> metadataDigitalSignature SWIFT_PRIVATE;
85
+ std::optional<std::string> metadataDeviceName SWIFT_PRIVATE;
86
+ std::optional<std::string> metadataDeviceManufacturerName SWIFT_PRIVATE;
87
+ std::optional<std::string> metadataSyncIdentifier SWIFT_PRIVATE;
88
+ std::optional<double> metadataSyncVersion SWIFT_PRIVATE;
89
+ std::optional<bool> metadataWasTakenInLab SWIFT_PRIVATE;
90
+ std::optional<double> metadataReferenceRangeLowerLimit SWIFT_PRIVATE;
91
+ std::optional<double> metadataReferenceRangeUpperLimit SWIFT_PRIVATE;
92
+ std::optional<double> metadataAlgorithmVersion SWIFT_PRIVATE;
56
93
 
57
94
  public:
58
95
  HeartbeatSeriesSample() = default;
59
- explicit HeartbeatSeriesSample(std::string uuid, std::optional<Device> device, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, std::vector<Heartbeat> heartbeats, std::optional<std::shared_ptr<AnyMap>> metadata, std::optional<SourceRevision> sourceRevision): uuid(uuid), device(device), startDate(startDate), endDate(endDate), heartbeats(heartbeats), metadata(metadata), sourceRevision(sourceRevision) {}
96
+ explicit HeartbeatSeriesSample(std::vector<Heartbeat> heartbeats, 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): heartbeats(heartbeats), 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) {}
60
97
  };
61
98
 
62
99
  } // namespace margelo::nitro::healthkit
@@ -69,24 +106,68 @@ namespace margelo::nitro {
69
106
  static inline margelo::nitro::healthkit::HeartbeatSeriesSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
70
107
  jsi::Object obj = arg.asObject(runtime);
71
108
  return margelo::nitro::healthkit::HeartbeatSeriesSample(
72
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
73
- JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
109
+ JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::fromJSI(runtime, obj.getProperty(runtime, "heartbeats")),
110
+ JSIConverter<margelo::nitro::healthkit::SampleType>::fromJSI(runtime, obj.getProperty(runtime, "sampleType")),
74
111
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "startDate")),
75
112
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "endDate")),
76
- JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::fromJSI(runtime, obj.getProperty(runtime, "heartbeats")),
77
- JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
78
- JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision"))
113
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "hasUndeterminedDuration")),
114
+ JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWeatherCondition")),
115
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWeatherHumidity")),
116
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWeatherTemperature")),
117
+ JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::fromJSI(runtime, obj.getProperty(runtime, "metadataInsulinDeliveryReason")),
118
+ JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::fromJSI(runtime, obj.getProperty(runtime, "metadataHeartRateMotionContext")),
119
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
120
+ JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision")),
121
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
122
+ JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
123
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataExternalUUID")),
124
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataTimeZone")),
125
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWasUserEntered")),
126
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDeviceSerialNumber")),
127
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataUdiDeviceIdentifier")),
128
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataUdiProductionIdentifier")),
129
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDigitalSignature")),
130
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDeviceName")),
131
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDeviceManufacturerName")),
132
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataSyncIdentifier")),
133
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataSyncVersion")),
134
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWasTakenInLab")),
135
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataReferenceRangeLowerLimit")),
136
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataReferenceRangeUpperLimit")),
137
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataAlgorithmVersion"))
79
138
  );
80
139
  }
81
140
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::HeartbeatSeriesSample& arg) {
82
141
  jsi::Object obj(runtime);
83
- obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
84
- obj.setProperty(runtime, "device", JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
142
+ obj.setProperty(runtime, "heartbeats", JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::toJSI(runtime, arg.heartbeats));
143
+ obj.setProperty(runtime, "sampleType", JSIConverter<margelo::nitro::healthkit::SampleType>::toJSI(runtime, arg.sampleType));
85
144
  obj.setProperty(runtime, "startDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
86
145
  obj.setProperty(runtime, "endDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
87
- obj.setProperty(runtime, "heartbeats", JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::toJSI(runtime, arg.heartbeats));
88
- obj.setProperty(runtime, "metadata", JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.metadata));
89
- obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::toJSI(runtime, arg.sourceRevision));
146
+ obj.setProperty(runtime, "hasUndeterminedDuration", JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
147
+ obj.setProperty(runtime, "metadataWeatherCondition", JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::toJSI(runtime, arg.metadataWeatherCondition));
148
+ obj.setProperty(runtime, "metadataWeatherHumidity", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherHumidity));
149
+ obj.setProperty(runtime, "metadataWeatherTemperature", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherTemperature));
150
+ obj.setProperty(runtime, "metadataInsulinDeliveryReason", JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::toJSI(runtime, arg.metadataInsulinDeliveryReason));
151
+ obj.setProperty(runtime, "metadataHeartRateMotionContext", JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::toJSI(runtime, arg.metadataHeartRateMotionContext));
152
+ obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
153
+ obj.setProperty(runtime, "sourceRevision", JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
154
+ obj.setProperty(runtime, "device", JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
155
+ obj.setProperty(runtime, "metadata", JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
156
+ obj.setProperty(runtime, "metadataExternalUUID", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataExternalUUID));
157
+ obj.setProperty(runtime, "metadataTimeZone", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataTimeZone));
158
+ obj.setProperty(runtime, "metadataWasUserEntered", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasUserEntered));
159
+ obj.setProperty(runtime, "metadataDeviceSerialNumber", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceSerialNumber));
160
+ obj.setProperty(runtime, "metadataUdiDeviceIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiDeviceIdentifier));
161
+ obj.setProperty(runtime, "metadataUdiProductionIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiProductionIdentifier));
162
+ obj.setProperty(runtime, "metadataDigitalSignature", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDigitalSignature));
163
+ obj.setProperty(runtime, "metadataDeviceName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceName));
164
+ obj.setProperty(runtime, "metadataDeviceManufacturerName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceManufacturerName));
165
+ obj.setProperty(runtime, "metadataSyncIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataSyncIdentifier));
166
+ obj.setProperty(runtime, "metadataSyncVersion", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataSyncVersion));
167
+ obj.setProperty(runtime, "metadataWasTakenInLab", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasTakenInLab));
168
+ obj.setProperty(runtime, "metadataReferenceRangeLowerLimit", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeLowerLimit));
169
+ obj.setProperty(runtime, "metadataReferenceRangeUpperLimit", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeUpperLimit));
170
+ obj.setProperty(runtime, "metadataAlgorithmVersion", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataAlgorithmVersion));
90
171
  return obj;
91
172
  }
92
173
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -97,13 +178,35 @@ namespace margelo::nitro {
97
178
  if (!nitro::isPlainObject(runtime, obj)) {
98
179
  return false;
99
180
  }
100
- if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
101
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
181
+ if (!JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::canConvert(runtime, obj.getProperty(runtime, "heartbeats"))) return false;
182
+ if (!JSIConverter<margelo::nitro::healthkit::SampleType>::canConvert(runtime, obj.getProperty(runtime, "sampleType"))) return false;
102
183
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false;
103
184
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false;
104
- if (!JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::canConvert(runtime, obj.getProperty(runtime, "heartbeats"))) return false;
105
- if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
106
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
185
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "hasUndeterminedDuration"))) return false;
186
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::canConvert(runtime, obj.getProperty(runtime, "metadataWeatherCondition"))) return false;
187
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataWeatherHumidity"))) return false;
188
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataWeatherTemperature"))) return false;
189
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::canConvert(runtime, obj.getProperty(runtime, "metadataInsulinDeliveryReason"))) return false;
190
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::canConvert(runtime, obj.getProperty(runtime, "metadataHeartRateMotionContext"))) return false;
191
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
192
+ if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
193
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
194
+ if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
195
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataExternalUUID"))) return false;
196
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataTimeZone"))) return false;
197
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "metadataWasUserEntered"))) return false;
198
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDeviceSerialNumber"))) return false;
199
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataUdiDeviceIdentifier"))) return false;
200
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataUdiProductionIdentifier"))) return false;
201
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDigitalSignature"))) return false;
202
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDeviceName"))) return false;
203
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDeviceManufacturerName"))) return false;
204
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataSyncIdentifier"))) return false;
205
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataSyncVersion"))) return false;
206
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "metadataWasTakenInLab"))) return false;
207
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataReferenceRangeLowerLimit"))) return false;
208
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataReferenceRangeUpperLimit"))) return false;
209
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataAlgorithmVersion"))) return false;
107
210
  return true;
108
211
  }
109
212
  };
@@ -31,7 +31,6 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
31
31
  #include "CategorySample.hpp"
32
32
  #include <vector>
33
33
  #include "QueryOptionsWithSortOrder.hpp"
34
- #include <optional>
35
34
  #include "CategorySamplesWithAnchorResponse.hpp"
36
35
  #include "QueryOptionsWithAnchor.hpp"
37
36
 
@@ -67,7 +66,7 @@ namespace margelo::nitro::healthkit {
67
66
  public:
68
67
  // Methods
69
68
  virtual std::shared_ptr<Promise<bool>> saveCategorySample(CategoryTypeIdentifier identifier, double value, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const std::shared_ptr<AnyMap>& metadata) = 0;
70
- virtual std::shared_ptr<Promise<std::vector<CategorySample>>> queryCategorySamples(CategoryTypeIdentifier identifier, const std::optional<QueryOptionsWithSortOrder>& options) = 0;
69
+ virtual std::shared_ptr<Promise<std::vector<CategorySample>>> queryCategorySamples(CategoryTypeIdentifier identifier, const QueryOptionsWithSortOrder& options) = 0;
71
70
  virtual std::shared_ptr<Promise<CategorySamplesWithAnchorResponse>> queryCategorySamplesWithAnchor(CategoryTypeIdentifier identifier, const QueryOptionsWithAnchor& options) = 0;
72
71
 
73
72
  protected:
@@ -21,6 +21,7 @@ namespace margelo::nitro::healthkit {
21
21
  prototype.registerHybridMethod("isHealthDataAvailableAsync", &HybridCoreModuleSpec::isHealthDataAvailableAsync);
22
22
  prototype.registerHybridMethod("isProtectedDataAvailable", &HybridCoreModuleSpec::isProtectedDataAvailable);
23
23
  prototype.registerHybridMethod("isProtectedDataAvailableAsync", &HybridCoreModuleSpec::isProtectedDataAvailableAsync);
24
+ prototype.registerHybridMethod("currentAppSource", &HybridCoreModuleSpec::currentAppSource);
24
25
  prototype.registerHybridMethod("getPreferredUnits", &HybridCoreModuleSpec::getPreferredUnits);
25
26
  prototype.registerHybridMethod("querySources", &HybridCoreModuleSpec::querySources);
26
27
  prototype.registerHybridMethod("subscribeToObserverQuery", &HybridCoreModuleSpec::subscribeToObserverQuery);
@@ -17,14 +17,16 @@
17
17
  namespace margelo::nitro::healthkit { enum class ObjectTypeIdentifier; }
18
18
  // Forward declaration of `UpdateFrequency` to properly resolve imports.
19
19
  namespace margelo::nitro::healthkit { enum class UpdateFrequency; }
20
+ // Forward declaration of `HybridSourceProxySpec` to properly resolve imports.
21
+ namespace margelo::nitro::healthkit { class HybridSourceProxySpec; }
20
22
  // Forward declaration of `IdentifierWithUnit` to properly resolve imports.
21
23
  namespace margelo::nitro::healthkit { struct IdentifierWithUnit; }
22
24
  // Forward declaration of `QuantityTypeIdentifier` to properly resolve imports.
23
25
  namespace margelo::nitro::healthkit { enum class QuantityTypeIdentifier; }
24
- // Forward declaration of `HybridSourceProxySpec` to properly resolve imports.
25
- namespace margelo::nitro::healthkit { class HybridSourceProxySpec; }
26
26
  // Forward declaration of `SampleTypeIdentifier` to properly resolve imports.
27
27
  namespace margelo::nitro::healthkit { enum class SampleTypeIdentifier; }
28
+ // Forward declaration of `FilterForSamples` to properly resolve imports.
29
+ namespace margelo::nitro::healthkit { struct FilterForSamples; }
28
30
  // Forward declaration of `OnChangeCallbackArgs` to properly resolve imports.
29
31
  namespace margelo::nitro::healthkit { struct OnChangeCallbackArgs; }
30
32
  // Forward declaration of `AuthorizationStatus` to properly resolve imports.
@@ -33,45 +35,24 @@ namespace margelo::nitro::healthkit { enum class AuthorizationStatus; }
33
35
  namespace margelo::nitro::healthkit { enum class AuthorizationRequestStatus; }
34
36
  // Forward declaration of `AuthDataTypes` to properly resolve imports.
35
37
  namespace margelo::nitro::healthkit { struct AuthDataTypes; }
36
- // Forward declaration of `PredicateWithUUID` to properly resolve imports.
37
- namespace margelo::nitro::healthkit { struct PredicateWithUUID; }
38
- // Forward declaration of `PredicateWithUUIDs` to properly resolve imports.
39
- namespace margelo::nitro::healthkit { struct PredicateWithUUIDs; }
40
- // Forward declaration of `PredicateWithMetadataKey` to properly resolve imports.
41
- namespace margelo::nitro::healthkit { struct PredicateWithMetadataKey; }
42
- // Forward declaration of `PredicateWithStartAndEnd` to properly resolve imports.
43
- namespace margelo::nitro::healthkit { struct PredicateWithStartAndEnd; }
44
- // Forward declaration of `PredicateFromWorkout` to properly resolve imports.
45
- namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
46
- // Forward declaration of `FilterForSamplesAnd` to properly resolve imports.
47
- namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
48
- // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
49
- namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
50
38
 
51
39
  #include <NitroModules/Promise.hpp>
52
40
  #include "ObjectTypeIdentifier.hpp"
53
41
  #include "UpdateFrequency.hpp"
42
+ #include <memory>
43
+ #include "HybridSourceProxySpec.hpp"
54
44
  #include "IdentifierWithUnit.hpp"
55
45
  #include <vector>
56
46
  #include "QuantityTypeIdentifier.hpp"
57
47
  #include <optional>
58
- #include <memory>
59
- #include "HybridSourceProxySpec.hpp"
60
48
  #include "SampleTypeIdentifier.hpp"
49
+ #include "FilterForSamples.hpp"
61
50
  #include <string>
62
51
  #include "OnChangeCallbackArgs.hpp"
63
52
  #include <functional>
64
53
  #include "AuthorizationStatus.hpp"
65
54
  #include "AuthorizationRequestStatus.hpp"
66
55
  #include "AuthDataTypes.hpp"
67
- #include "PredicateWithUUID.hpp"
68
- #include "PredicateWithUUIDs.hpp"
69
- #include "PredicateWithMetadataKey.hpp"
70
- #include "PredicateWithStartAndEnd.hpp"
71
- #include "PredicateFromWorkout.hpp"
72
- #include "FilterForSamplesAnd.hpp"
73
- #include "FilterForSamplesOr.hpp"
74
- #include <variant>
75
56
  #include <unordered_map>
76
57
 
77
58
  namespace margelo::nitro::healthkit {
@@ -112,8 +93,9 @@ namespace margelo::nitro::healthkit {
112
93
  virtual std::shared_ptr<Promise<bool>> isHealthDataAvailableAsync() = 0;
113
94
  virtual bool isProtectedDataAvailable() = 0;
114
95
  virtual std::shared_ptr<Promise<bool>> isProtectedDataAvailableAsync() = 0;
96
+ virtual std::shared_ptr<HybridSourceProxySpec> currentAppSource() = 0;
115
97
  virtual std::shared_ptr<Promise<std::vector<IdentifierWithUnit>>> getPreferredUnits(const std::vector<QuantityTypeIdentifier>& identifiers, std::optional<bool> forceUpdate) = 0;
116
- virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridSourceProxySpec>>>> querySources(SampleTypeIdentifier identifier) = 0;
98
+ virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridSourceProxySpec>>>> querySources(SampleTypeIdentifier identifier, const std::optional<FilterForSamples>& filter) = 0;
117
99
  virtual std::string subscribeToObserverQuery(SampleTypeIdentifier typeIdentifier, const std::function<void(const OnChangeCallbackArgs& /* args */)>& callback) = 0;
118
100
  virtual bool unsubscribeQuery(const std::string& queryId) = 0;
119
101
  virtual std::shared_ptr<Promise<bool>> unsubscribeQueryAsync(const std::string& queryId) = 0;
@@ -122,7 +104,7 @@ namespace margelo::nitro::healthkit {
122
104
  virtual AuthorizationStatus authorizationStatusFor(ObjectTypeIdentifier type) = 0;
123
105
  virtual std::shared_ptr<Promise<AuthorizationRequestStatus>> getRequestStatusForAuthorization(const AuthDataTypes& toCheck) = 0;
124
106
  virtual std::shared_ptr<Promise<bool>> requestAuthorization(const AuthDataTypes& toRequest) = 0;
125
- virtual std::shared_ptr<Promise<double>> deleteObjects(ObjectTypeIdentifier objectTypeIdentifier, const std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout, FilterForSamplesAnd, FilterForSamplesOr>& filter) = 0;
107
+ virtual std::shared_ptr<Promise<double>> deleteObjects(ObjectTypeIdentifier objectTypeIdentifier, const FilterForSamples& filter) = 0;
126
108
  virtual bool isObjectTypeAvailable(ObjectTypeIdentifier objectTypeIdentifier) = 0;
127
109
  virtual std::unordered_map<std::string, bool> areObjectTypesAvailable(const std::vector<ObjectTypeIdentifier>& objectTypeIdentifiers) = 0;
128
110
  virtual std::shared_ptr<Promise<std::unordered_map<std::string, bool>>> areObjectTypesAvailableAsync(const std::vector<ObjectTypeIdentifier>& objectTypeIdentifiers) = 0;
@@ -16,6 +16,7 @@ namespace margelo::nitro::healthkit {
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridMethod("saveCorrelationSample", &HybridCorrelationTypeModuleSpec::saveCorrelationSample);
18
18
  prototype.registerHybridMethod("queryCorrelationSamples", &HybridCorrelationTypeModuleSpec::queryCorrelationSamples);
19
+ prototype.registerHybridMethod("queryCorrelationSamplesWithAnchor", &HybridCorrelationTypeModuleSpec::queryCorrelationSamplesWithAnchor);
19
20
  });
20
21
  }
21
22
 
@@ -21,6 +21,12 @@ namespace margelo::nitro::healthkit { struct CategorySampleForSaving; }
21
21
  namespace margelo::nitro::healthkit { struct QuantitySampleForSaving; }
22
22
  // Forward declaration of `CorrelationSample` to properly resolve imports.
23
23
  namespace margelo::nitro::healthkit { struct CorrelationSample; }
24
+ // Forward declaration of `QueryOptionsWithSortOrder` to properly resolve imports.
25
+ namespace margelo::nitro::healthkit { struct QueryOptionsWithSortOrder; }
26
+ // Forward declaration of `QueryCorrelationSamplesWithAnchorResponse` to properly resolve imports.
27
+ namespace margelo::nitro::healthkit { struct QueryCorrelationSamplesWithAnchorResponse; }
28
+ // Forward declaration of `QueryOptionsWithAnchor` to properly resolve imports.
29
+ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
24
30
 
25
31
  #include <NitroModules/Promise.hpp>
26
32
  #include "CorrelationTypeIdentifier.hpp"
@@ -31,6 +37,9 @@ namespace margelo::nitro::healthkit { struct CorrelationSample; }
31
37
  #include <chrono>
32
38
  #include <NitroModules/AnyMap.hpp>
33
39
  #include "CorrelationSample.hpp"
40
+ #include "QueryOptionsWithSortOrder.hpp"
41
+ #include "QueryCorrelationSamplesWithAnchorResponse.hpp"
42
+ #include "QueryOptionsWithAnchor.hpp"
34
43
 
35
44
  namespace margelo::nitro::healthkit {
36
45
 
@@ -64,7 +73,8 @@ namespace margelo::nitro::healthkit {
64
73
  public:
65
74
  // Methods
66
75
  virtual std::shared_ptr<Promise<bool>> saveCorrelationSample(CorrelationTypeIdentifier typeIdentifier, const std::vector<std::variant<CategorySampleForSaving, QuantitySampleForSaving>>& samples, std::chrono::system_clock::time_point start, std::chrono::system_clock::time_point end, const std::shared_ptr<AnyMap>& metadata) = 0;
67
- virtual std::shared_ptr<Promise<std::vector<CorrelationSample>>> queryCorrelationSamples(CorrelationTypeIdentifier typeIdentifier, std::chrono::system_clock::time_point from, std::chrono::system_clock::time_point to) = 0;
76
+ virtual std::shared_ptr<Promise<std::vector<CorrelationSample>>> queryCorrelationSamples(CorrelationTypeIdentifier typeIdentifier, const QueryOptionsWithSortOrder& options) = 0;
77
+ virtual std::shared_ptr<Promise<QueryCorrelationSamplesWithAnchorResponse>> queryCorrelationSamplesWithAnchor(CorrelationTypeIdentifier typeIdentifier, const QueryOptionsWithAnchor& options) = 0;
68
78
 
69
79
  protected:
70
80
  // Hybrid Setup
@@ -26,7 +26,6 @@ namespace margelo::nitro::healthkit { struct ECGQueryOptionsWithAnchor; }
26
26
  #include <vector>
27
27
  #include <NitroModules/Promise.hpp>
28
28
  #include "ECGQueryOptionsWithSortOrder.hpp"
29
- #include <optional>
30
29
  #include "ElectrocardiogramSamplesWithAnchorResponse.hpp"
31
30
  #include "ECGQueryOptionsWithAnchor.hpp"
32
31
 
@@ -61,7 +60,7 @@ namespace margelo::nitro::healthkit {
61
60
 
62
61
  public:
63
62
  // Methods
64
- virtual std::shared_ptr<Promise<std::vector<ElectrocardiogramSample>>> queryElectrocardiogramSamples(const std::optional<ECGQueryOptionsWithSortOrder>& options) = 0;
63
+ virtual std::shared_ptr<Promise<std::vector<ElectrocardiogramSample>>> queryElectrocardiogramSamples(const ECGQueryOptionsWithSortOrder& options) = 0;
65
64
  virtual std::shared_ptr<Promise<ElectrocardiogramSamplesWithAnchorResponse>> queryElectrocardiogramSamplesWithAnchor(const ECGQueryOptionsWithAnchor& options) = 0;
66
65
 
67
66
  protected:
@@ -26,7 +26,6 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
26
26
  #include <vector>
27
27
  #include <NitroModules/Promise.hpp>
28
28
  #include "QueryOptionsWithSortOrder.hpp"
29
- #include <optional>
30
29
  #include "HeartbeatSeriesSamplesWithAnchorResponse.hpp"
31
30
  #include "QueryOptionsWithAnchor.hpp"
32
31
 
@@ -61,7 +60,7 @@ namespace margelo::nitro::healthkit {
61
60
 
62
61
  public:
63
62
  // Methods
64
- virtual std::shared_ptr<Promise<std::vector<HeartbeatSeriesSample>>> queryHeartbeatSeriesSamples(const std::optional<QueryOptionsWithSortOrder>& options) = 0;
63
+ virtual std::shared_ptr<Promise<std::vector<HeartbeatSeriesSample>>> queryHeartbeatSeriesSamples(const QueryOptionsWithSortOrder& options) = 0;
65
64
  virtual std::shared_ptr<Promise<HeartbeatSeriesSamplesWithAnchorResponse>> queryHeartbeatSeriesSamplesWithAnchor(const QueryOptionsWithAnchor& options) = 0;
66
65
 
67
66
  protected:
@@ -0,0 +1,24 @@
1
+ ///
2
+ /// HybridMedicationModuleSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridMedicationModuleSpec.hpp"
9
+
10
+ namespace margelo::nitro::healthkit {
11
+
12
+ void HybridMedicationModuleSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("queryMedications", &HybridMedicationModuleSpec::queryMedications);
18
+ prototype.registerHybridMethod("requestMedicationsAuthorization", &HybridMedicationModuleSpec::requestMedicationsAuthorization);
19
+ prototype.registerHybridMethod("queryMedicationEvents", &HybridMedicationModuleSpec::queryMedicationEvents);
20
+ prototype.registerHybridMethod("queryMedicationEventsWithAnchor", &HybridMedicationModuleSpec::queryMedicationEventsWithAnchor);
21
+ });
22
+ }
23
+
24
+ } // namespace margelo::nitro::healthkit
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// HybridMedicationModuleSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `UserAnnotatedMedication` to properly resolve imports.
17
+ namespace margelo::nitro::healthkit { struct UserAnnotatedMedication; }
18
+ // Forward declaration of `MedicationDoseEvent` to properly resolve imports.
19
+ namespace margelo::nitro::healthkit { struct MedicationDoseEvent; }
20
+ // Forward declaration of `QueryOptionsWithSortOrder` to properly resolve imports.
21
+ namespace margelo::nitro::healthkit { struct QueryOptionsWithSortOrder; }
22
+ // Forward declaration of `MedicationDoseEventsWithAnchorResponse` to properly resolve imports.
23
+ namespace margelo::nitro::healthkit { struct MedicationDoseEventsWithAnchorResponse; }
24
+ // Forward declaration of `QueryOptionsWithAnchor` to properly resolve imports.
25
+ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
26
+
27
+ #include "UserAnnotatedMedication.hpp"
28
+ #include <vector>
29
+ #include <NitroModules/Promise.hpp>
30
+ #include "MedicationDoseEvent.hpp"
31
+ #include "QueryOptionsWithSortOrder.hpp"
32
+ #include "MedicationDoseEventsWithAnchorResponse.hpp"
33
+ #include "QueryOptionsWithAnchor.hpp"
34
+
35
+ namespace margelo::nitro::healthkit {
36
+
37
+ using namespace margelo::nitro;
38
+
39
+ /**
40
+ * An abstract base class for `MedicationModule`
41
+ * Inherit this class to create instances of `HybridMedicationModuleSpec` in C++.
42
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
43
+ * @example
44
+ * ```cpp
45
+ * class HybridMedicationModule: public HybridMedicationModuleSpec {
46
+ * public:
47
+ * HybridMedicationModule(...): HybridObject(TAG) { ... }
48
+ * // ...
49
+ * };
50
+ * ```
51
+ */
52
+ class HybridMedicationModuleSpec: public virtual HybridObject {
53
+ public:
54
+ // Constructor
55
+ explicit HybridMedicationModuleSpec(): HybridObject(TAG) { }
56
+
57
+ // Destructor
58
+ ~HybridMedicationModuleSpec() override = default;
59
+
60
+ public:
61
+ // Properties
62
+
63
+
64
+ public:
65
+ // Methods
66
+ virtual std::shared_ptr<Promise<std::vector<UserAnnotatedMedication>>> queryMedications() = 0;
67
+ virtual std::shared_ptr<Promise<bool>> requestMedicationsAuthorization() = 0;
68
+ virtual std::shared_ptr<Promise<std::vector<MedicationDoseEvent>>> queryMedicationEvents(const QueryOptionsWithSortOrder& options) = 0;
69
+ virtual std::shared_ptr<Promise<MedicationDoseEventsWithAnchorResponse>> queryMedicationEventsWithAnchor(const QueryOptionsWithAnchor& options) = 0;
70
+
71
+ protected:
72
+ // Hybrid Setup
73
+ void loadHybridMethods() override;
74
+
75
+ protected:
76
+ // Tag for logging
77
+ static constexpr auto TAG = "MedicationModule";
78
+ };
79
+
80
+ } // namespace margelo::nitro::healthkit
@@ -15,8 +15,8 @@ namespace margelo::nitro::healthkit {
15
15
  // load custom methods/properties
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridMethod("isQuantityCompatibleWithUnit", &HybridQuantityTypeModuleSpec::isQuantityCompatibleWithUnit);
18
+ prototype.registerHybridMethod("aggregationStyle", &HybridQuantityTypeModuleSpec::aggregationStyle);
18
19
  prototype.registerHybridMethod("saveQuantitySample", &HybridQuantityTypeModuleSpec::saveQuantitySample);
19
- prototype.registerHybridMethod("deleteQuantitySamples", &HybridQuantityTypeModuleSpec::deleteQuantitySamples);
20
20
  prototype.registerHybridMethod("queryQuantitySamples", &HybridQuantityTypeModuleSpec::queryQuantitySamples);
21
21
  prototype.registerHybridMethod("queryStatisticsForQuantity", &HybridQuantityTypeModuleSpec::queryStatisticsForQuantity);
22
22
  prototype.registerHybridMethod("queryStatisticsCollectionForQuantity", &HybridQuantityTypeModuleSpec::queryStatisticsCollectionForQuantity);
@@ -15,20 +15,8 @@
15
15
 
16
16
  // Forward declaration of `QuantityTypeIdentifier` to properly resolve imports.
17
17
  namespace margelo::nitro::healthkit { enum class QuantityTypeIdentifier; }
18
- // Forward declaration of `PredicateWithUUID` to properly resolve imports.
19
- namespace margelo::nitro::healthkit { struct PredicateWithUUID; }
20
- // Forward declaration of `PredicateWithUUIDs` to properly resolve imports.
21
- namespace margelo::nitro::healthkit { struct PredicateWithUUIDs; }
22
- // Forward declaration of `PredicateWithMetadataKey` to properly resolve imports.
23
- namespace margelo::nitro::healthkit { struct PredicateWithMetadataKey; }
24
- // Forward declaration of `PredicateWithStartAndEnd` to properly resolve imports.
25
- namespace margelo::nitro::healthkit { struct PredicateWithStartAndEnd; }
26
- // Forward declaration of `PredicateFromWorkout` to properly resolve imports.
27
- namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
28
- // Forward declaration of `FilterForSamplesAnd` to properly resolve imports.
29
- namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
30
- // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
31
- namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
18
+ // Forward declaration of `AggregationStyle` to properly resolve imports.
19
+ namespace margelo::nitro::healthkit { enum class AggregationStyle; }
32
20
  // Forward declaration of `QuantitySample` to properly resolve imports.
33
21
  namespace margelo::nitro::healthkit { struct QuantitySample; }
34
22
  // Forward declaration of `QueryOptionsWithSortOrderAndUnit` to properly resolve imports.
@@ -48,24 +36,17 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
48
36
 
49
37
  #include "QuantityTypeIdentifier.hpp"
50
38
  #include <string>
39
+ #include "AggregationStyle.hpp"
51
40
  #include <NitroModules/Promise.hpp>
52
41
  #include <chrono>
53
42
  #include <NitroModules/AnyMap.hpp>
54
- #include "PredicateWithUUID.hpp"
55
- #include "PredicateWithUUIDs.hpp"
56
- #include "PredicateWithMetadataKey.hpp"
57
- #include "PredicateWithStartAndEnd.hpp"
58
- #include "PredicateFromWorkout.hpp"
59
- #include "FilterForSamplesAnd.hpp"
60
- #include "FilterForSamplesOr.hpp"
61
- #include <variant>
62
43
  #include "QuantitySample.hpp"
63
44
  #include <vector>
64
45
  #include "QueryOptionsWithSortOrderAndUnit.hpp"
65
- #include <optional>
66
46
  #include "QueryStatisticsResponse.hpp"
67
47
  #include "StatisticsOptions.hpp"
68
48
  #include "StatisticsQueryOptions.hpp"
49
+ #include <optional>
69
50
  #include "IntervalComponents.hpp"
70
51
  #include "QuantitySamplesWithAnchorResponse.hpp"
71
52
  #include "QueryOptionsWithAnchorAndUnit.hpp"
@@ -102,9 +83,9 @@ namespace margelo::nitro::healthkit {
102
83
  public:
103
84
  // Methods
104
85
  virtual bool isQuantityCompatibleWithUnit(QuantityTypeIdentifier identifier, const std::string& unit) = 0;
86
+ virtual AggregationStyle aggregationStyle(QuantityTypeIdentifier identifier) = 0;
105
87
  virtual std::shared_ptr<Promise<bool>> saveQuantitySample(QuantityTypeIdentifier identifier, const std::string& unit, double value, std::chrono::system_clock::time_point start, std::chrono::system_clock::time_point end, const std::shared_ptr<AnyMap>& metadata) = 0;
106
- virtual std::shared_ptr<Promise<bool>> deleteQuantitySamples(QuantityTypeIdentifier identifier, const std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout, FilterForSamplesAnd, FilterForSamplesOr>& filter) = 0;
107
- virtual std::shared_ptr<Promise<std::vector<QuantitySample>>> queryQuantitySamples(QuantityTypeIdentifier identifier, const std::optional<QueryOptionsWithSortOrderAndUnit>& options) = 0;
88
+ virtual std::shared_ptr<Promise<std::vector<QuantitySample>>> queryQuantitySamples(QuantityTypeIdentifier identifier, const QueryOptionsWithSortOrderAndUnit& options) = 0;
108
89
  virtual std::shared_ptr<Promise<QueryStatisticsResponse>> queryStatisticsForQuantity(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, const std::optional<StatisticsQueryOptions>& options) = 0;
109
90
  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;
110
91
  virtual std::shared_ptr<Promise<QuantitySamplesWithAnchorResponse>> queryQuantitySamplesWithAnchor(QuantityTypeIdentifier identifier, const QueryOptionsWithAnchorAndUnit& options) = 0;
@@ -15,6 +15,7 @@ namespace margelo::nitro::healthkit {
15
15
  // load custom methods/properties
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridMethod("queryStateOfMindSamples", &HybridStateOfMindModuleSpec::queryStateOfMindSamples);
18
+ prototype.registerHybridMethod("queryStateOfMindSamplesWithAnchor", &HybridStateOfMindModuleSpec::queryStateOfMindSamplesWithAnchor);
18
19
  prototype.registerHybridMethod("saveStateOfMindSample", &HybridStateOfMindModuleSpec::saveStateOfMindSample);
19
20
  });
20
21
  }