@kingstinct/react-native-healthkit 13.3.1 → 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 (191) 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 +4 -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 +20 -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 +3 -116
  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/WorkoutEvent.swift +20 -2
  117. package/nitrogen/generated/ios/swift/WorkoutSample.swift +4 -402
  118. package/nitrogen/generated/shared/c++/CategorySample.hpp +8 -100
  119. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +153 -149
  120. package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +328 -0
  121. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +9 -105
  122. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -99
  123. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +13 -13
  124. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +13 -13
  125. package/nitrogen/generated/shared/c++/GeneralForm.hpp +7 -7
  126. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +8 -100
  127. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +5 -2
  128. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +2 -0
  129. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -2
  130. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +15 -15
  131. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +1 -27
  132. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +2 -37
  133. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -99
  134. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +565 -565
  135. package/nitrogen/generated/shared/c++/QuantitySample.hpp +8 -100
  136. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +407 -411
  137. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +398 -402
  138. package/nitrogen/generated/shared/c++/{QueryOptionsWithAnchorAndUnit.hpp → QueryOptionsWithAnchorAndStringUnit.hpp} +11 -11
  139. package/nitrogen/generated/shared/c++/{QueryOptionsWithSortOrderAndUnit.hpp → QueryOptionsWithSortOrderAndStringUnit.hpp} +11 -11
  140. package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +12 -12
  141. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +559 -559
  142. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +541 -545
  143. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +8 -100
  144. package/nitrogen/generated/shared/c++/{StatisticsQueryOptions.hpp → StatisticsQueryOptionsWithStringUnit.hpp} +11 -11
  145. package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +8 -2
  146. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +7 -120
  147. package/package.json +5 -2
  148. package/src/generated/healthkit-schema.json +3680 -0
  149. package/src/generated/healthkit.generated.ts +1307 -0
  150. package/src/healthkit.ios.ts +225 -19
  151. package/src/healthkit.ts +181 -55
  152. package/src/hooks/useMostRecentQuantitySample.ts +6 -5
  153. package/src/hooks/useMostRecentWorkout.ts +2 -2
  154. package/src/hooks/useQuantitySampleById.ts +6 -5
  155. package/src/hooks/useStatisticsForQuantity.ts +2 -1
  156. package/src/hooks/useSubscribeToQuantitySamples.ts +1 -1
  157. package/src/modules.ts +7 -2
  158. package/src/specs/CategoryTypeModule.nitro.ts +8 -5
  159. package/src/specs/CoreModule.nitro.ts +20 -0
  160. package/src/specs/QuantityTypeModule.nitro.ts +81 -7
  161. package/src/test-setup.ts +2 -0
  162. package/src/type-tests/generated-typing.ts +133 -0
  163. package/src/types/CategoryType.ts +52 -148
  164. package/src/types/CategoryTypeIdentifier.ts +5 -134
  165. package/src/types/CorrelationType.ts +13 -3
  166. package/src/types/ElectrocardiogramSample.ts +13 -1
  167. package/src/types/HeartbeatSeries.ts +13 -1
  168. package/src/types/InterfaceVerification.ts +38 -1
  169. package/src/types/Medication.ts +19 -0
  170. package/src/types/MetadataEnums.ts +15 -0
  171. package/src/types/QuantitySample.ts +14 -2
  172. package/src/types/QuantityType.ts +22 -122
  173. package/src/types/QuantityTypeIdentifier.ts +5 -772
  174. package/src/types/QueryOptions.ts +11 -4
  175. package/src/types/Shared.ts +22 -49
  176. package/src/types/StateOfMind.ts +13 -1
  177. package/src/types/Subscriptions.ts +19 -13
  178. package/src/types/WeatherCondition.ts +1 -31
  179. package/src/types/Workouts.ts +46 -108
  180. package/src/types/index.ts +2 -0
  181. package/src/utils/getMostRecentQuantitySample.ts +4 -3
  182. package/src/utils/getMostRecentWorkout.ts +5 -2
  183. package/src/utils/getPreferredUnit.ts +5 -4
  184. package/src/utils/getQuantitySampleById.ts +4 -3
  185. package/src/utils/subscribeToQuantitySamples.ts +5 -3
  186. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +0 -44
  187. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +0 -40
  188. package/nitrogen/generated/ios/swift/WeatherCondition.swift +0 -144
  189. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +0 -67
  190. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +0 -62
  191. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +0 -88
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// QueryOptionsWithAnchorAndUnit.hpp
2
+ /// QueryOptionsWithAnchorAndStringUnit.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © Marc Rousavy @ Margelo
@@ -38,9 +38,9 @@ namespace margelo::nitro::healthkit { struct FilterForSamples; }
38
38
  namespace margelo::nitro::healthkit {
39
39
 
40
40
  /**
41
- * A struct which can be represented as a JavaScript object (QueryOptionsWithAnchorAndUnit).
41
+ * A struct which can be represented as a JavaScript object (QueryOptionsWithAnchorAndStringUnit).
42
42
  */
43
- struct QueryOptionsWithAnchorAndUnit final {
43
+ struct QueryOptionsWithAnchorAndStringUnit final {
44
44
  public:
45
45
  std::optional<std::string> unit SWIFT_PRIVATE;
46
46
  std::optional<std::string> anchor SWIFT_PRIVATE;
@@ -48,30 +48,30 @@ namespace margelo::nitro::healthkit {
48
48
  double limit SWIFT_PRIVATE;
49
49
 
50
50
  public:
51
- QueryOptionsWithAnchorAndUnit() = default;
52
- explicit QueryOptionsWithAnchorAndUnit(std::optional<std::string> unit, std::optional<std::string> anchor, std::optional<FilterForSamples> filter, double limit): unit(unit), anchor(anchor), filter(filter), limit(limit) {}
51
+ QueryOptionsWithAnchorAndStringUnit() = default;
52
+ explicit QueryOptionsWithAnchorAndStringUnit(std::optional<std::string> unit, std::optional<std::string> anchor, std::optional<FilterForSamples> filter, double limit): unit(unit), anchor(anchor), filter(filter), limit(limit) {}
53
53
 
54
54
  public:
55
- friend bool operator==(const QueryOptionsWithAnchorAndUnit& lhs, const QueryOptionsWithAnchorAndUnit& rhs) = default;
55
+ friend bool operator==(const QueryOptionsWithAnchorAndStringUnit& lhs, const QueryOptionsWithAnchorAndStringUnit& rhs) = default;
56
56
  };
57
57
 
58
58
  } // namespace margelo::nitro::healthkit
59
59
 
60
60
  namespace margelo::nitro {
61
61
 
62
- // C++ QueryOptionsWithAnchorAndUnit <> JS QueryOptionsWithAnchorAndUnit (object)
62
+ // C++ QueryOptionsWithAnchorAndStringUnit <> JS QueryOptionsWithAnchorAndStringUnit (object)
63
63
  template <>
64
- struct JSIConverter<margelo::nitro::healthkit::QueryOptionsWithAnchorAndUnit> final {
65
- static inline margelo::nitro::healthkit::QueryOptionsWithAnchorAndUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
+ struct JSIConverter<margelo::nitro::healthkit::QueryOptionsWithAnchorAndStringUnit> final {
65
+ static inline margelo::nitro::healthkit::QueryOptionsWithAnchorAndStringUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
66
  jsi::Object obj = arg.asObject(runtime);
67
- return margelo::nitro::healthkit::QueryOptionsWithAnchorAndUnit(
67
+ return margelo::nitro::healthkit::QueryOptionsWithAnchorAndStringUnit(
68
68
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))),
69
69
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "anchor"))),
70
70
  JSIConverter<std::optional<margelo::nitro::healthkit::FilterForSamples>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filter"))),
71
71
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limit")))
72
72
  );
73
73
  }
74
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryOptionsWithAnchorAndUnit& arg) {
74
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryOptionsWithAnchorAndStringUnit& arg) {
75
75
  jsi::Object obj(runtime);
76
76
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.unit));
77
77
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "anchor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.anchor));
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// QueryOptionsWithSortOrderAndUnit.hpp
2
+ /// QueryOptionsWithSortOrderAndStringUnit.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © Marc Rousavy @ Margelo
@@ -38,9 +38,9 @@ namespace margelo::nitro::healthkit { struct FilterForSamples; }
38
38
  namespace margelo::nitro::healthkit {
39
39
 
40
40
  /**
41
- * A struct which can be represented as a JavaScript object (QueryOptionsWithSortOrderAndUnit).
41
+ * A struct which can be represented as a JavaScript object (QueryOptionsWithSortOrderAndStringUnit).
42
42
  */
43
- struct QueryOptionsWithSortOrderAndUnit final {
43
+ struct QueryOptionsWithSortOrderAndStringUnit final {
44
44
  public:
45
45
  std::optional<std::string> unit SWIFT_PRIVATE;
46
46
  std::optional<bool> ascending SWIFT_PRIVATE;
@@ -48,30 +48,30 @@ namespace margelo::nitro::healthkit {
48
48
  double limit SWIFT_PRIVATE;
49
49
 
50
50
  public:
51
- QueryOptionsWithSortOrderAndUnit() = default;
52
- explicit QueryOptionsWithSortOrderAndUnit(std::optional<std::string> unit, std::optional<bool> ascending, std::optional<FilterForSamples> filter, double limit): unit(unit), ascending(ascending), filter(filter), limit(limit) {}
51
+ QueryOptionsWithSortOrderAndStringUnit() = default;
52
+ explicit QueryOptionsWithSortOrderAndStringUnit(std::optional<std::string> unit, std::optional<bool> ascending, std::optional<FilterForSamples> filter, double limit): unit(unit), ascending(ascending), filter(filter), limit(limit) {}
53
53
 
54
54
  public:
55
- friend bool operator==(const QueryOptionsWithSortOrderAndUnit& lhs, const QueryOptionsWithSortOrderAndUnit& rhs) = default;
55
+ friend bool operator==(const QueryOptionsWithSortOrderAndStringUnit& lhs, const QueryOptionsWithSortOrderAndStringUnit& rhs) = default;
56
56
  };
57
57
 
58
58
  } // namespace margelo::nitro::healthkit
59
59
 
60
60
  namespace margelo::nitro {
61
61
 
62
- // C++ QueryOptionsWithSortOrderAndUnit <> JS QueryOptionsWithSortOrderAndUnit (object)
62
+ // C++ QueryOptionsWithSortOrderAndStringUnit <> JS QueryOptionsWithSortOrderAndStringUnit (object)
63
63
  template <>
64
- struct JSIConverter<margelo::nitro::healthkit::QueryOptionsWithSortOrderAndUnit> final {
65
- static inline margelo::nitro::healthkit::QueryOptionsWithSortOrderAndUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
+ struct JSIConverter<margelo::nitro::healthkit::QueryOptionsWithSortOrderAndStringUnit> final {
65
+ static inline margelo::nitro::healthkit::QueryOptionsWithSortOrderAndStringUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
66
  jsi::Object obj = arg.asObject(runtime);
67
- return margelo::nitro::healthkit::QueryOptionsWithSortOrderAndUnit(
67
+ return margelo::nitro::healthkit::QueryOptionsWithSortOrderAndStringUnit(
68
68
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))),
69
69
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ascending"))),
70
70
  JSIConverter<std::optional<margelo::nitro::healthkit::FilterForSamples>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filter"))),
71
71
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limit")))
72
72
  );
73
73
  }
74
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryOptionsWithSortOrderAndUnit& arg) {
74
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryOptionsWithSortOrderAndStringUnit& arg) {
75
75
  jsi::Object obj(runtime);
76
76
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.unit));
77
77
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "ascending"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.ascending));
@@ -37,10 +37,10 @@ namespace margelo::nitro::healthkit { struct QuantityDateInterval; }
37
37
 
38
38
  #include <memory>
39
39
  #include "HybridSourceProxySpec.hpp"
40
- #include "Quantity.hpp"
40
+ #include <chrono>
41
41
  #include <optional>
42
+ #include "Quantity.hpp"
42
43
  #include "QuantityDateInterval.hpp"
43
- #include <chrono>
44
44
 
45
45
  namespace margelo::nitro::healthkit {
46
46
 
@@ -50,6 +50,8 @@ namespace margelo::nitro::healthkit {
50
50
  struct QueryStatisticsResponseFromSingleSource final {
51
51
  public:
52
52
  std::shared_ptr<HybridSourceProxySpec> source SWIFT_PRIVATE;
53
+ std::optional<std::chrono::system_clock::time_point> startDate SWIFT_PRIVATE;
54
+ std::optional<std::chrono::system_clock::time_point> endDate SWIFT_PRIVATE;
53
55
  std::optional<Quantity> duration SWIFT_PRIVATE;
54
56
  std::optional<Quantity> averageQuantity SWIFT_PRIVATE;
55
57
  std::optional<Quantity> maximumQuantity SWIFT_PRIVATE;
@@ -57,12 +59,10 @@ namespace margelo::nitro::healthkit {
57
59
  std::optional<Quantity> sumQuantity SWIFT_PRIVATE;
58
60
  std::optional<Quantity> mostRecentQuantity SWIFT_PRIVATE;
59
61
  std::optional<QuantityDateInterval> mostRecentQuantityDateInterval SWIFT_PRIVATE;
60
- std::optional<std::chrono::system_clock::time_point> startDate SWIFT_PRIVATE;
61
- std::optional<std::chrono::system_clock::time_point> endDate SWIFT_PRIVATE;
62
62
 
63
63
  public:
64
64
  QueryStatisticsResponseFromSingleSource() = default;
65
- explicit QueryStatisticsResponseFromSingleSource(std::shared_ptr<HybridSourceProxySpec> source, std::optional<Quantity> duration, std::optional<Quantity> averageQuantity, std::optional<Quantity> maximumQuantity, std::optional<Quantity> minimumQuantity, std::optional<Quantity> sumQuantity, std::optional<Quantity> mostRecentQuantity, std::optional<QuantityDateInterval> mostRecentQuantityDateInterval, std::optional<std::chrono::system_clock::time_point> startDate, std::optional<std::chrono::system_clock::time_point> endDate): source(source), duration(duration), averageQuantity(averageQuantity), maximumQuantity(maximumQuantity), minimumQuantity(minimumQuantity), sumQuantity(sumQuantity), mostRecentQuantity(mostRecentQuantity), mostRecentQuantityDateInterval(mostRecentQuantityDateInterval), startDate(startDate), endDate(endDate) {}
65
+ explicit QueryStatisticsResponseFromSingleSource(std::shared_ptr<HybridSourceProxySpec> source, std::optional<std::chrono::system_clock::time_point> startDate, std::optional<std::chrono::system_clock::time_point> endDate, std::optional<Quantity> duration, std::optional<Quantity> averageQuantity, std::optional<Quantity> maximumQuantity, std::optional<Quantity> minimumQuantity, std::optional<Quantity> sumQuantity, std::optional<Quantity> mostRecentQuantity, std::optional<QuantityDateInterval> mostRecentQuantityDateInterval): source(source), startDate(startDate), endDate(endDate), duration(duration), averageQuantity(averageQuantity), maximumQuantity(maximumQuantity), minimumQuantity(minimumQuantity), sumQuantity(sumQuantity), mostRecentQuantity(mostRecentQuantity), mostRecentQuantityDateInterval(mostRecentQuantityDateInterval) {}
66
66
 
67
67
  public:
68
68
  friend bool operator==(const QueryStatisticsResponseFromSingleSource& lhs, const QueryStatisticsResponseFromSingleSource& rhs) = default;
@@ -79,20 +79,22 @@ namespace margelo::nitro {
79
79
  jsi::Object obj = arg.asObject(runtime);
80
80
  return margelo::nitro::healthkit::QueryStatisticsResponseFromSingleSource(
81
81
  JSIConverter<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source"))),
82
+ JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
83
+ JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
82
84
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
83
85
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageQuantity"))),
84
86
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumQuantity"))),
85
87
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumQuantity"))),
86
88
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sumQuantity"))),
87
89
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantity"))),
88
- JSIConverter<std::optional<margelo::nitro::healthkit::QuantityDateInterval>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantityDateInterval"))),
89
- JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
90
- JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))
90
+ JSIConverter<std::optional<margelo::nitro::healthkit::QuantityDateInterval>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantityDateInterval")))
91
91
  );
92
92
  }
93
93
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryStatisticsResponseFromSingleSource& arg) {
94
94
  jsi::Object obj(runtime);
95
95
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "source"), JSIConverter<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>::toJSI(runtime, arg.source));
96
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.startDate));
97
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.endDate));
96
98
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.duration));
97
99
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "averageQuantity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.averageQuantity));
98
100
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumQuantity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.maximumQuantity));
@@ -100,8 +102,6 @@ namespace margelo::nitro {
100
102
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "sumQuantity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.sumQuantity));
101
103
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.mostRecentQuantity));
102
104
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantityDateInterval"), JSIConverter<std::optional<margelo::nitro::healthkit::QuantityDateInterval>>::toJSI(runtime, arg.mostRecentQuantityDateInterval));
103
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.startDate));
104
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.endDate));
105
105
  return obj;
106
106
  }
107
107
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -113,6 +113,8 @@ namespace margelo::nitro {
113
113
  return false;
114
114
  }
115
115
  if (!JSIConverter<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source")))) return false;
116
+ if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
117
+ if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
116
118
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
117
119
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageQuantity")))) return false;
118
120
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumQuantity")))) return false;
@@ -120,8 +122,6 @@ namespace margelo::nitro {
120
122
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sumQuantity")))) return false;
121
123
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantity")))) return false;
122
124
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::QuantityDateInterval>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mostRecentQuantityDateInterval")))) return false;
123
- if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
124
- if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
125
125
  return true;
126
126
  }
127
127
  };