@capgo/capacitor-health 8.2.17 → 8.3.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.
- package/README.md +42 -3
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +20 -0
- package/android/src/main/java/app/capgo/plugin/health/HealthDataType.kt +24 -1
- package/android/src/main/java/app/capgo/plugin/health/HealthManager.kt +264 -14
- package/android/src/main/java/app/capgo/plugin/health/HealthPlugin.kt +4 -1
- package/android/src/main/java/app/capgo/plugin/health/WorkoutType.kt +117 -1
- package/dist/docs.json +336 -0
- package/dist/esm/definitions.d.ts +11 -3
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/HealthPlugin/Health.swift +582 -2
- package/ios/Sources/HealthPlugin/HealthPlugin.swift +7 -2
- package/package.json +1 -1
|
@@ -2,6 +2,28 @@ package app.capgo.plugin.health
|
|
|
2
2
|
|
|
3
3
|
import androidx.health.connect.client.records.ExerciseSessionRecord
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* WorkoutType mapper between TypeScript workout types and Android Health Connect exercise types.
|
|
7
|
+
*
|
|
8
|
+
* Note: Due to platform limitations, some TypeScript workout types map to the same Android
|
|
9
|
+
* exercise type. When reading workouts from Android, these will return the primary/legacy
|
|
10
|
+
* workout type to maintain backward compatibility:
|
|
11
|
+
*
|
|
12
|
+
* - highIntensityIntervalTraining, mixedCardio, crossTraining → reads as "crossTraining"
|
|
13
|
+
* - kickboxing, martialArts, wrestling → reads as "wrestling"
|
|
14
|
+
* - wheelchairRunPace, wheelchairWalkPace → reads as "wheelchairWalkPace"
|
|
15
|
+
* - stairs, stairClimbing → reads as "stairClimbing"
|
|
16
|
+
* - barre, pilates → reads as "pilates"
|
|
17
|
+
* - cooldown, flexibility, preparationAndRecovery → reads as "flexibility"
|
|
18
|
+
* - coreTraining, functionalStrengthTraining, strengthTraining, traditionalStrengthTraining → reads as "strengthTraining"
|
|
19
|
+
* - mindAndBody, taiChi, yoga → reads as "yoga"
|
|
20
|
+
* - trackAndField, running → reads as "running"
|
|
21
|
+
* - cardioDance, socialDance, dance → reads as "dance"
|
|
22
|
+
* - crossCountrySkiing, downhillSkiing → reads as "downhillSkiing"
|
|
23
|
+
*
|
|
24
|
+
* This asymmetric mapping is intentional to support the full iOS workout type set while
|
|
25
|
+
* maintaining compatibility with Android's more limited exercise type taxonomy.
|
|
26
|
+
*/
|
|
5
27
|
object WorkoutType {
|
|
6
28
|
fun fromString(type: String?): Int? {
|
|
7
29
|
if (type.isNullOrBlank()) return null
|
|
@@ -28,6 +50,67 @@ object WorkoutType {
|
|
|
28
50
|
"waterPolo" -> ExerciseSessionRecord.EXERCISE_TYPE_WATER_POLO
|
|
29
51
|
"waterSports" -> ExerciseSessionRecord.EXERCISE_TYPE_SWIMMING_OPEN_WATER
|
|
30
52
|
"wrestling" -> ExerciseSessionRecord.EXERCISE_TYPE_MARTIAL_ARTS
|
|
53
|
+
// New comprehensive workout type mappings
|
|
54
|
+
"archery" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
55
|
+
"australianFootball" -> ExerciseSessionRecord.EXERCISE_TYPE_FOOTBALL_AUSTRALIAN
|
|
56
|
+
"badminton" -> ExerciseSessionRecord.EXERCISE_TYPE_BADMINTON
|
|
57
|
+
"barre" -> ExerciseSessionRecord.EXERCISE_TYPE_PILATES
|
|
58
|
+
"bowling" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
59
|
+
"boxing" -> ExerciseSessionRecord.EXERCISE_TYPE_BOXING
|
|
60
|
+
"climbing" -> ExerciseSessionRecord.EXERCISE_TYPE_ROCK_CLIMBING
|
|
61
|
+
"cooldown" -> ExerciseSessionRecord.EXERCISE_TYPE_STRETCHING
|
|
62
|
+
"coreTraining" -> ExerciseSessionRecord.EXERCISE_TYPE_STRENGTH_TRAINING
|
|
63
|
+
"cricket" -> ExerciseSessionRecord.EXERCISE_TYPE_CRICKET
|
|
64
|
+
"crossCountrySkiing" -> ExerciseSessionRecord.EXERCISE_TYPE_SKIING
|
|
65
|
+
"curling" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
66
|
+
"dance" -> ExerciseSessionRecord.EXERCISE_TYPE_DANCING
|
|
67
|
+
"discSports" -> ExerciseSessionRecord.EXERCISE_TYPE_FRISBEE_DISC
|
|
68
|
+
"downhillSkiing" -> ExerciseSessionRecord.EXERCISE_TYPE_SKIING
|
|
69
|
+
"equestrianSports" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
70
|
+
"fencing" -> ExerciseSessionRecord.EXERCISE_TYPE_FENCING
|
|
71
|
+
"fishing" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
72
|
+
"fitnessGaming" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
73
|
+
"flexibility" -> ExerciseSessionRecord.EXERCISE_TYPE_STRETCHING
|
|
74
|
+
"functionalStrengthTraining" -> ExerciseSessionRecord.EXERCISE_TYPE_STRENGTH_TRAINING
|
|
75
|
+
"golf" -> ExerciseSessionRecord.EXERCISE_TYPE_GOLF
|
|
76
|
+
"gymnastics" -> ExerciseSessionRecord.EXERCISE_TYPE_GYMNASTICS
|
|
77
|
+
"handball" -> ExerciseSessionRecord.EXERCISE_TYPE_HANDBALL
|
|
78
|
+
"handCycling" -> ExerciseSessionRecord.EXERCISE_TYPE_WHEELCHAIR
|
|
79
|
+
"highIntensityIntervalTraining" -> ExerciseSessionRecord.EXERCISE_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING
|
|
80
|
+
"hockey" -> ExerciseSessionRecord.EXERCISE_TYPE_ICE_HOCKEY
|
|
81
|
+
"hunting" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
82
|
+
"jumpRope" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
83
|
+
"kickboxing" -> ExerciseSessionRecord.EXERCISE_TYPE_MARTIAL_ARTS
|
|
84
|
+
"lacrosse" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
85
|
+
"martialArts" -> ExerciseSessionRecord.EXERCISE_TYPE_MARTIAL_ARTS
|
|
86
|
+
"mindAndBody" -> ExerciseSessionRecord.EXERCISE_TYPE_YOGA
|
|
87
|
+
"mixedCardio" -> ExerciseSessionRecord.EXERCISE_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING
|
|
88
|
+
"paddleSports" -> ExerciseSessionRecord.EXERCISE_TYPE_PADDLING
|
|
89
|
+
"pickleball" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
90
|
+
"pilates" -> ExerciseSessionRecord.EXERCISE_TYPE_PILATES
|
|
91
|
+
"play" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
92
|
+
"preparationAndRecovery" -> ExerciseSessionRecord.EXERCISE_TYPE_STRETCHING
|
|
93
|
+
"racquetball" -> ExerciseSessionRecord.EXERCISE_TYPE_RACQUETBALL
|
|
94
|
+
"rugby" -> ExerciseSessionRecord.EXERCISE_TYPE_RUGBY
|
|
95
|
+
"sailing" -> ExerciseSessionRecord.EXERCISE_TYPE_SAILING
|
|
96
|
+
"skatingSports" -> ExerciseSessionRecord.EXERCISE_TYPE_SKATING
|
|
97
|
+
"snowboarding" -> ExerciseSessionRecord.EXERCISE_TYPE_SNOWBOARDING
|
|
98
|
+
"snowSports" -> ExerciseSessionRecord.EXERCISE_TYPE_SNOWSHOEING
|
|
99
|
+
"softball" -> ExerciseSessionRecord.EXERCISE_TYPE_SOFTBALL
|
|
100
|
+
"squash" -> ExerciseSessionRecord.EXERCISE_TYPE_SQUASH
|
|
101
|
+
"stairs" -> ExerciseSessionRecord.EXERCISE_TYPE_STAIR_CLIMBING
|
|
102
|
+
"stepTraining" -> ExerciseSessionRecord.EXERCISE_TYPE_STAIR_CLIMBING_MACHINE
|
|
103
|
+
"surfingSports" -> ExerciseSessionRecord.EXERCISE_TYPE_SURFING
|
|
104
|
+
"tableTennis" -> ExerciseSessionRecord.EXERCISE_TYPE_TABLE_TENNIS
|
|
105
|
+
"taiChi" -> ExerciseSessionRecord.EXERCISE_TYPE_YOGA
|
|
106
|
+
"trackAndField" -> ExerciseSessionRecord.EXERCISE_TYPE_RUNNING
|
|
107
|
+
"transition" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
108
|
+
"underwaterDiving" -> ExerciseSessionRecord.EXERCISE_TYPE_SCUBA_DIVING
|
|
109
|
+
"volleyball" -> ExerciseSessionRecord.EXERCISE_TYPE_VOLLEYBALL
|
|
110
|
+
"wheelchairRunPace" -> ExerciseSessionRecord.EXERCISE_TYPE_WHEELCHAIR
|
|
111
|
+
"wheelchairWalkPace" -> ExerciseSessionRecord.EXERCISE_TYPE_WHEELCHAIR
|
|
112
|
+
"cardioDance" -> ExerciseSessionRecord.EXERCISE_TYPE_DANCING
|
|
113
|
+
"socialDance" -> ExerciseSessionRecord.EXERCISE_TYPE_DANCING
|
|
31
114
|
"other" -> ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT
|
|
32
115
|
else -> null
|
|
33
116
|
}
|
|
@@ -49,14 +132,47 @@ object WorkoutType {
|
|
|
49
132
|
ExerciseSessionRecord.EXERCISE_TYPE_SOCCER -> "soccer"
|
|
50
133
|
ExerciseSessionRecord.EXERCISE_TYPE_FOOTBALL_AMERICAN -> "americanFootball"
|
|
51
134
|
ExerciseSessionRecord.EXERCISE_TYPE_BASEBALL -> "baseball"
|
|
135
|
+
// Keep backward compatible mapping for existing types
|
|
52
136
|
ExerciseSessionRecord.EXERCISE_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING -> "crossTraining"
|
|
53
137
|
ExerciseSessionRecord.EXERCISE_TYPE_ELLIPTICAL -> "elliptical"
|
|
54
138
|
ExerciseSessionRecord.EXERCISE_TYPE_ROWING -> "rowing"
|
|
55
139
|
ExerciseSessionRecord.EXERCISE_TYPE_ROWING_MACHINE -> "rowing"
|
|
140
|
+
// Keep stairClimbing as primary mapping for backward compatibility
|
|
56
141
|
ExerciseSessionRecord.EXERCISE_TYPE_STAIR_CLIMBING -> "stairClimbing"
|
|
57
|
-
ExerciseSessionRecord.EXERCISE_TYPE_STAIR_CLIMBING_MACHINE -> "
|
|
142
|
+
ExerciseSessionRecord.EXERCISE_TYPE_STAIR_CLIMBING_MACHINE -> "stepTraining"
|
|
58
143
|
ExerciseSessionRecord.EXERCISE_TYPE_WATER_POLO -> "waterPolo"
|
|
144
|
+
// Keep wrestling as primary mapping for backward compatibility
|
|
59
145
|
ExerciseSessionRecord.EXERCISE_TYPE_MARTIAL_ARTS -> "wrestling"
|
|
146
|
+
// Comprehensive Android to TypeScript workout type mappings
|
|
147
|
+
ExerciseSessionRecord.EXERCISE_TYPE_FOOTBALL_AUSTRALIAN -> "australianFootball"
|
|
148
|
+
ExerciseSessionRecord.EXERCISE_TYPE_BADMINTON -> "badminton"
|
|
149
|
+
ExerciseSessionRecord.EXERCISE_TYPE_PILATES -> "pilates"
|
|
150
|
+
ExerciseSessionRecord.EXERCISE_TYPE_BOXING -> "boxing"
|
|
151
|
+
ExerciseSessionRecord.EXERCISE_TYPE_ROCK_CLIMBING -> "climbing"
|
|
152
|
+
ExerciseSessionRecord.EXERCISE_TYPE_STRETCHING -> "flexibility"
|
|
153
|
+
ExerciseSessionRecord.EXERCISE_TYPE_CRICKET -> "cricket"
|
|
154
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SKIING -> "downhillSkiing"
|
|
155
|
+
ExerciseSessionRecord.EXERCISE_TYPE_DANCING -> "dance"
|
|
156
|
+
ExerciseSessionRecord.EXERCISE_TYPE_FRISBEE_DISC -> "discSports"
|
|
157
|
+
ExerciseSessionRecord.EXERCISE_TYPE_FENCING -> "fencing"
|
|
158
|
+
ExerciseSessionRecord.EXERCISE_TYPE_GOLF -> "golf"
|
|
159
|
+
ExerciseSessionRecord.EXERCISE_TYPE_GYMNASTICS -> "gymnastics"
|
|
160
|
+
ExerciseSessionRecord.EXERCISE_TYPE_HANDBALL -> "handball"
|
|
161
|
+
ExerciseSessionRecord.EXERCISE_TYPE_WHEELCHAIR -> "wheelchairWalkPace"
|
|
162
|
+
ExerciseSessionRecord.EXERCISE_TYPE_ICE_HOCKEY -> "hockey"
|
|
163
|
+
ExerciseSessionRecord.EXERCISE_TYPE_PADDLING -> "paddleSports"
|
|
164
|
+
ExerciseSessionRecord.EXERCISE_TYPE_RACQUETBALL -> "racquetball"
|
|
165
|
+
ExerciseSessionRecord.EXERCISE_TYPE_RUGBY -> "rugby"
|
|
166
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SAILING -> "sailing"
|
|
167
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SKATING -> "skatingSports"
|
|
168
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SNOWBOARDING -> "snowboarding"
|
|
169
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SNOWSHOEING -> "snowSports"
|
|
170
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SOFTBALL -> "softball"
|
|
171
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SQUASH -> "squash"
|
|
172
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SURFING -> "surfingSports"
|
|
173
|
+
ExerciseSessionRecord.EXERCISE_TYPE_TABLE_TENNIS -> "tableTennis"
|
|
174
|
+
ExerciseSessionRecord.EXERCISE_TYPE_SCUBA_DIVING -> "underwaterDiving"
|
|
175
|
+
ExerciseSessionRecord.EXERCISE_TYPE_VOLLEYBALL -> "volleyball"
|
|
60
176
|
ExerciseSessionRecord.EXERCISE_TYPE_OTHER_WORKOUT -> "other"
|
|
61
177
|
else -> "other"
|
|
62
178
|
}
|
package/dist/docs.json
CHANGED
|
@@ -397,6 +397,20 @@
|
|
|
397
397
|
"SleepState"
|
|
398
398
|
],
|
|
399
399
|
"type": "SleepState"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"name": "systolic",
|
|
403
|
+
"tags": [],
|
|
404
|
+
"docs": "For blood pressure data, the systolic value in mmHg.",
|
|
405
|
+
"complexTypes": [],
|
|
406
|
+
"type": "number | undefined"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "diastolic",
|
|
410
|
+
"tags": [],
|
|
411
|
+
"docs": "For blood pressure data, the diastolic value in mmHg.",
|
|
412
|
+
"complexTypes": [],
|
|
413
|
+
"type": "number | undefined"
|
|
400
414
|
}
|
|
401
415
|
]
|
|
402
416
|
},
|
|
@@ -500,6 +514,20 @@
|
|
|
500
514
|
"Record"
|
|
501
515
|
],
|
|
502
516
|
"type": "Record<string, string>"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "systolic",
|
|
520
|
+
"tags": [],
|
|
521
|
+
"docs": "For blood pressure data, the systolic value in mmHg. Required when dataType is 'bloodPressure'.",
|
|
522
|
+
"complexTypes": [],
|
|
523
|
+
"type": "number | undefined"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"name": "diastolic",
|
|
527
|
+
"tags": [],
|
|
528
|
+
"docs": "For blood pressure data, the diastolic value in mmHg. Required when dataType is 'bloodPressure'.",
|
|
529
|
+
"complexTypes": [],
|
|
530
|
+
"type": "number | undefined"
|
|
503
531
|
}
|
|
504
532
|
]
|
|
505
533
|
},
|
|
@@ -811,6 +839,54 @@
|
|
|
811
839
|
{
|
|
812
840
|
"text": "'heartRateVariability'",
|
|
813
841
|
"complexTypes": []
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"text": "'bloodPressure'",
|
|
845
|
+
"complexTypes": []
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"text": "'bloodGlucose'",
|
|
849
|
+
"complexTypes": []
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"text": "'bodyTemperature'",
|
|
853
|
+
"complexTypes": []
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"text": "'height'",
|
|
857
|
+
"complexTypes": []
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"text": "'flightsClimbed'",
|
|
861
|
+
"complexTypes": []
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"text": "'exerciseTime'",
|
|
865
|
+
"complexTypes": []
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"text": "'distanceCycling'",
|
|
869
|
+
"complexTypes": []
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
"text": "'bodyFat'",
|
|
873
|
+
"complexTypes": []
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"text": "'basalBodyTemperature'",
|
|
877
|
+
"complexTypes": []
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
"text": "'basalCalories'",
|
|
881
|
+
"complexTypes": []
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
"text": "'totalCalories'",
|
|
885
|
+
"complexTypes": []
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"text": "'mindfulness'",
|
|
889
|
+
"complexTypes": []
|
|
814
890
|
}
|
|
815
891
|
]
|
|
816
892
|
},
|
|
@@ -850,6 +926,26 @@
|
|
|
850
926
|
{
|
|
851
927
|
"text": "'millisecond'",
|
|
852
928
|
"complexTypes": []
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"text": "'mmHg'",
|
|
932
|
+
"complexTypes": []
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
"text": "'mg/dL'",
|
|
936
|
+
"complexTypes": []
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
"text": "'celsius'",
|
|
940
|
+
"complexTypes": []
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
"text": "'fahrenheit'",
|
|
944
|
+
"complexTypes": []
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
"text": "'centimeter'",
|
|
948
|
+
"complexTypes": []
|
|
853
949
|
}
|
|
854
950
|
]
|
|
855
951
|
},
|
|
@@ -987,6 +1083,246 @@
|
|
|
987
1083
|
"text": "'wrestling'",
|
|
988
1084
|
"complexTypes": []
|
|
989
1085
|
},
|
|
1086
|
+
{
|
|
1087
|
+
"text": "'archery'",
|
|
1088
|
+
"complexTypes": []
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
"text": "'australianFootball'",
|
|
1092
|
+
"complexTypes": []
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
"text": "'badminton'",
|
|
1096
|
+
"complexTypes": []
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
"text": "'barre'",
|
|
1100
|
+
"complexTypes": []
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"text": "'bowling'",
|
|
1104
|
+
"complexTypes": []
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
"text": "'boxing'",
|
|
1108
|
+
"complexTypes": []
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
"text": "'climbing'",
|
|
1112
|
+
"complexTypes": []
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
"text": "'cooldown'",
|
|
1116
|
+
"complexTypes": []
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
"text": "'coreTraining'",
|
|
1120
|
+
"complexTypes": []
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
"text": "'cricket'",
|
|
1124
|
+
"complexTypes": []
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
"text": "'crossCountrySkiing'",
|
|
1128
|
+
"complexTypes": []
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
"text": "'curling'",
|
|
1132
|
+
"complexTypes": []
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
"text": "'dance'",
|
|
1136
|
+
"complexTypes": []
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
"text": "'discSports'",
|
|
1140
|
+
"complexTypes": []
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
"text": "'downhillSkiing'",
|
|
1144
|
+
"complexTypes": []
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"text": "'equestrianSports'",
|
|
1148
|
+
"complexTypes": []
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
"text": "'fencing'",
|
|
1152
|
+
"complexTypes": []
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
"text": "'fishing'",
|
|
1156
|
+
"complexTypes": []
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
"text": "'fitnessGaming'",
|
|
1160
|
+
"complexTypes": []
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
"text": "'flexibility'",
|
|
1164
|
+
"complexTypes": []
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"text": "'functionalStrengthTraining'",
|
|
1168
|
+
"complexTypes": []
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
"text": "'golf'",
|
|
1172
|
+
"complexTypes": []
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
"text": "'gymnastics'",
|
|
1176
|
+
"complexTypes": []
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
"text": "'handball'",
|
|
1180
|
+
"complexTypes": []
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
"text": "'handCycling'",
|
|
1184
|
+
"complexTypes": []
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
"text": "'highIntensityIntervalTraining'",
|
|
1188
|
+
"complexTypes": []
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
"text": "'hockey'",
|
|
1192
|
+
"complexTypes": []
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
"text": "'hunting'",
|
|
1196
|
+
"complexTypes": []
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
"text": "'jumpRope'",
|
|
1200
|
+
"complexTypes": []
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
"text": "'kickboxing'",
|
|
1204
|
+
"complexTypes": []
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
"text": "'lacrosse'",
|
|
1208
|
+
"complexTypes": []
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
"text": "'martialArts'",
|
|
1212
|
+
"complexTypes": []
|
|
1213
|
+
},
|
|
1214
|
+
{
|
|
1215
|
+
"text": "'mindAndBody'",
|
|
1216
|
+
"complexTypes": []
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
"text": "'mixedCardio'",
|
|
1220
|
+
"complexTypes": []
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
"text": "'paddleSports'",
|
|
1224
|
+
"complexTypes": []
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
"text": "'pickleball'",
|
|
1228
|
+
"complexTypes": []
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
"text": "'pilates'",
|
|
1232
|
+
"complexTypes": []
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
"text": "'play'",
|
|
1236
|
+
"complexTypes": []
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
"text": "'preparationAndRecovery'",
|
|
1240
|
+
"complexTypes": []
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
"text": "'racquetball'",
|
|
1244
|
+
"complexTypes": []
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
"text": "'rugby'",
|
|
1248
|
+
"complexTypes": []
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
"text": "'sailing'",
|
|
1252
|
+
"complexTypes": []
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
"text": "'skatingSports'",
|
|
1256
|
+
"complexTypes": []
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
"text": "'snowboarding'",
|
|
1260
|
+
"complexTypes": []
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
"text": "'snowSports'",
|
|
1264
|
+
"complexTypes": []
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
"text": "'softball'",
|
|
1268
|
+
"complexTypes": []
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
"text": "'squash'",
|
|
1272
|
+
"complexTypes": []
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
"text": "'stairs'",
|
|
1276
|
+
"complexTypes": []
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
"text": "'stepTraining'",
|
|
1280
|
+
"complexTypes": []
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"text": "'surfingSports'",
|
|
1284
|
+
"complexTypes": []
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
"text": "'tableTennis'",
|
|
1288
|
+
"complexTypes": []
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
"text": "'taiChi'",
|
|
1292
|
+
"complexTypes": []
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
"text": "'trackAndField'",
|
|
1296
|
+
"complexTypes": []
|
|
1297
|
+
},
|
|
1298
|
+
{
|
|
1299
|
+
"text": "'transition'",
|
|
1300
|
+
"complexTypes": []
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
"text": "'underwaterDiving'",
|
|
1304
|
+
"complexTypes": []
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
"text": "'volleyball'",
|
|
1308
|
+
"complexTypes": []
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
"text": "'wheelchairRunPace'",
|
|
1312
|
+
"complexTypes": []
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
"text": "'wheelchairWalkPace'",
|
|
1316
|
+
"complexTypes": []
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"text": "'cardioDance'",
|
|
1320
|
+
"complexTypes": []
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
"text": "'socialDance'",
|
|
1324
|
+
"complexTypes": []
|
|
1325
|
+
},
|
|
990
1326
|
{
|
|
991
1327
|
"text": "'other'",
|
|
992
1328
|
"complexTypes": []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type HealthDataType = 'steps' | 'distance' | 'calories' | 'heartRate' | 'weight' | 'sleep' | 'respiratoryRate' | 'oxygenSaturation' | 'restingHeartRate' | 'heartRateVariability';
|
|
2
|
-
export type HealthUnit = 'count' | 'meter' | 'kilocalorie' | 'bpm' | 'kilogram' | 'minute' | 'percent' | 'millisecond';
|
|
1
|
+
export type HealthDataType = 'steps' | 'distance' | 'calories' | 'heartRate' | 'weight' | 'sleep' | 'respiratoryRate' | 'oxygenSaturation' | 'restingHeartRate' | 'heartRateVariability' | 'bloodPressure' | 'bloodGlucose' | 'bodyTemperature' | 'height' | 'flightsClimbed' | 'exerciseTime' | 'distanceCycling' | 'bodyFat' | 'basalBodyTemperature' | 'basalCalories' | 'totalCalories' | 'mindfulness';
|
|
2
|
+
export type HealthUnit = 'count' | 'meter' | 'kilocalorie' | 'bpm' | 'kilogram' | 'minute' | 'percent' | 'millisecond' | 'mmHg' | 'mg/dL' | 'celsius' | 'fahrenheit' | 'centimeter';
|
|
3
3
|
export interface AuthorizationOptions {
|
|
4
4
|
/** Data types that should be readable after authorization. */
|
|
5
5
|
read?: HealthDataType[];
|
|
@@ -41,11 +41,15 @@ export interface HealthSample {
|
|
|
41
41
|
sourceId?: string;
|
|
42
42
|
/** For sleep data, indicates the sleep state (e.g., 'asleep', 'awake', 'rem', 'deep', 'light'). */
|
|
43
43
|
sleepState?: SleepState;
|
|
44
|
+
/** For blood pressure data, the systolic value in mmHg. */
|
|
45
|
+
systolic?: number;
|
|
46
|
+
/** For blood pressure data, the diastolic value in mmHg. */
|
|
47
|
+
diastolic?: number;
|
|
44
48
|
}
|
|
45
49
|
export interface ReadSamplesResult {
|
|
46
50
|
samples: HealthSample[];
|
|
47
51
|
}
|
|
48
|
-
export type WorkoutType = 'running' | 'cycling' | 'walking' | 'swimming' | 'yoga' | 'strengthTraining' | 'hiking' | 'tennis' | 'basketball' | 'soccer' | 'americanFootball' | 'baseball' | 'crossTraining' | 'elliptical' | 'rowing' | 'stairClimbing' | 'traditionalStrengthTraining' | 'waterFitness' | 'waterPolo' | 'waterSports' | 'wrestling' | 'other';
|
|
52
|
+
export type WorkoutType = 'running' | 'cycling' | 'walking' | 'swimming' | 'yoga' | 'strengthTraining' | 'hiking' | 'tennis' | 'basketball' | 'soccer' | 'americanFootball' | 'baseball' | 'crossTraining' | 'elliptical' | 'rowing' | 'stairClimbing' | 'traditionalStrengthTraining' | 'waterFitness' | 'waterPolo' | 'waterSports' | 'wrestling' | 'archery' | 'australianFootball' | 'badminton' | 'barre' | 'bowling' | 'boxing' | 'climbing' | 'cooldown' | 'coreTraining' | 'cricket' | 'crossCountrySkiing' | 'curling' | 'dance' | 'discSports' | 'downhillSkiing' | 'equestrianSports' | 'fencing' | 'fishing' | 'fitnessGaming' | 'flexibility' | 'functionalStrengthTraining' | 'golf' | 'gymnastics' | 'handball' | 'handCycling' | 'highIntensityIntervalTraining' | 'hockey' | 'hunting' | 'jumpRope' | 'kickboxing' | 'lacrosse' | 'martialArts' | 'mindAndBody' | 'mixedCardio' | 'paddleSports' | 'pickleball' | 'pilates' | 'play' | 'preparationAndRecovery' | 'racquetball' | 'rugby' | 'sailing' | 'skatingSports' | 'snowboarding' | 'snowSports' | 'softball' | 'squash' | 'stairs' | 'stepTraining' | 'surfingSports' | 'tableTennis' | 'taiChi' | 'trackAndField' | 'transition' | 'underwaterDiving' | 'volleyball' | 'wheelchairRunPace' | 'wheelchairWalkPace' | 'cardioDance' | 'socialDance' | 'other';
|
|
49
53
|
export interface QueryWorkoutsOptions {
|
|
50
54
|
/** Optional workout type filter. If omitted, all workout types are returned. */
|
|
51
55
|
workoutType?: WorkoutType;
|
|
@@ -106,6 +110,10 @@ export interface WriteSampleOptions {
|
|
|
106
110
|
endDate?: string;
|
|
107
111
|
/** Metadata key-value pairs forwarded to the native APIs where supported. */
|
|
108
112
|
metadata?: Record<string, string>;
|
|
113
|
+
/** For blood pressure data, the systolic value in mmHg. Required when dataType is 'bloodPressure'. */
|
|
114
|
+
systolic?: number;
|
|
115
|
+
/** For blood pressure data, the diastolic value in mmHg. Required when dataType is 'bloodPressure'. */
|
|
116
|
+
diastolic?: number;
|
|
109
117
|
}
|
|
110
118
|
export type BucketType = 'hour' | 'day' | 'week' | 'month';
|
|
111
119
|
export type AggregationType = 'sum' | 'average' | 'min' | 'max';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type HealthDataType =\n | 'steps'\n | 'distance'\n | 'calories'\n | 'heartRate'\n | 'weight'\n | 'sleep'\n | 'respiratoryRate'\n | 'oxygenSaturation'\n | 'restingHeartRate'\n | 'heartRateVariability';\n\nexport type HealthUnit = 'count' | 'meter' | 'kilocalorie' | 'bpm' | 'kilogram' | 'minute' | 'percent' | 'millisecond';\n\nexport interface AuthorizationOptions {\n /** Data types that should be readable after authorization. */\n read?: HealthDataType[];\n /** Data types that should be writable after authorization. */\n write?: HealthDataType[];\n}\n\nexport interface AuthorizationStatus {\n readAuthorized: HealthDataType[];\n readDenied: HealthDataType[];\n writeAuthorized: HealthDataType[];\n writeDenied: HealthDataType[];\n}\n\nexport interface AvailabilityResult {\n available: boolean;\n /** Platform specific details (for debugging/diagnostics). */\n platform?: 'ios' | 'android' | 'web';\n reason?: string;\n}\n\nexport interface QueryOptions {\n /** The type of data to retrieve from the health store. */\n dataType: HealthDataType;\n /** Inclusive ISO 8601 start date (defaults to now - 1 day). */\n startDate?: string;\n /** Exclusive ISO 8601 end date (defaults to now). */\n endDate?: string;\n /** Maximum number of samples to return (defaults to 100). */\n limit?: number;\n /** Return results sorted ascending by start date (defaults to false). */\n ascending?: boolean;\n}\n\nexport type SleepState = 'inBed' | 'asleep' | 'awake' | 'rem' | 'deep' | 'light';\n\nexport interface HealthSample {\n dataType: HealthDataType;\n value: number;\n unit: HealthUnit;\n startDate: string;\n endDate: string;\n sourceName?: string;\n sourceId?: string;\n /** For sleep data, indicates the sleep state (e.g., 'asleep', 'awake', 'rem', 'deep', 'light'). */\n sleepState?: SleepState;\n}\n\nexport interface ReadSamplesResult {\n samples: HealthSample[];\n}\n\nexport type WorkoutType =\n | 'running'\n | 'cycling'\n | 'walking'\n | 'swimming'\n | 'yoga'\n | 'strengthTraining'\n | 'hiking'\n | 'tennis'\n | 'basketball'\n | 'soccer'\n | 'americanFootball'\n | 'baseball'\n | 'crossTraining'\n | 'elliptical'\n | 'rowing'\n | 'stairClimbing'\n | 'traditionalStrengthTraining'\n | 'waterFitness'\n | 'waterPolo'\n | 'waterSports'\n | 'wrestling'\n | 'other';\n\nexport interface QueryWorkoutsOptions {\n /** Optional workout type filter. If omitted, all workout types are returned. */\n workoutType?: WorkoutType;\n /** Inclusive ISO 8601 start date (defaults to now - 1 day). */\n startDate?: string;\n /** Exclusive ISO 8601 end date (defaults to now). */\n endDate?: string;\n /** Maximum number of workouts to return (defaults to 100). */\n limit?: number;\n /** Return results sorted ascending by start date (defaults to false). */\n ascending?: boolean;\n /**\n * Anchor for pagination. Use the anchor returned from a previous query to continue from that point.\n * On iOS, this uses HKQueryAnchor. On Android, this uses Health Connect's pageToken.\n * Omit this parameter to start from the beginning.\n */\n anchor?: string;\n}\n\nexport interface Workout {\n /** The type of workout. */\n workoutType: WorkoutType;\n /** Duration of the workout in seconds. */\n duration: number;\n /** Total energy burned in kilocalories (if available). */\n totalEnergyBurned?: number;\n /** Total distance in meters (if available). */\n totalDistance?: number;\n /** ISO 8601 start date of the workout. */\n startDate: string;\n /** ISO 8601 end date of the workout. */\n endDate: string;\n /** Source name that recorded the workout. */\n sourceName?: string;\n /** Source bundle identifier. */\n sourceId?: string;\n /** Additional metadata (if available). */\n metadata?: Record<string, string>;\n}\n\nexport interface QueryWorkoutsResult {\n workouts: Workout[];\n /**\n * Anchor for the next page of results. Pass this value as the anchor parameter in the next query\n * to continue pagination. If undefined or null, there are no more results.\n */\n anchor?: string;\n}\n\nexport interface WriteSampleOptions {\n dataType: HealthDataType;\n value: number;\n /**\n * Optional unit override. If omitted, the default unit for the data type is used\n * (count for `steps`, meter for `distance`, kilocalorie for `calories`, bpm for `heartRate`, kilogram for `weight`).\n */\n unit?: HealthUnit;\n /** ISO 8601 start date for the sample. Defaults to now. */\n startDate?: string;\n /** ISO 8601 end date for the sample. Defaults to startDate. */\n endDate?: string;\n /** Metadata key-value pairs forwarded to the native APIs where supported. */\n metadata?: Record<string, string>;\n}\n\nexport type BucketType = 'hour' | 'day' | 'week' | 'month';\n\nexport type AggregationType = 'sum' | 'average' | 'min' | 'max';\n\nexport interface QueryAggregatedOptions {\n /** The type of data to aggregate from the health store. */\n dataType: HealthDataType;\n /** Inclusive ISO 8601 start date (defaults to now - 1 day). */\n startDate?: string;\n /** Exclusive ISO 8601 end date (defaults to now). */\n endDate?: string;\n /** Time bucket for aggregation (defaults to 'day'). */\n bucket?: BucketType;\n /** Aggregation operation to perform (defaults to 'sum'). */\n aggregation?: AggregationType;\n}\n\nexport interface AggregatedSample {\n /** ISO 8601 start date of the bucket. */\n startDate: string;\n /** ISO 8601 end date of the bucket. */\n endDate: string;\n /** Aggregated value for the bucket. */\n value: number;\n /** Unit of the aggregated value. */\n unit: HealthUnit;\n}\n\nexport interface QueryAggregatedResult {\n samples: AggregatedSample[];\n}\n\nexport interface HealthPlugin {\n /** Returns whether the current platform supports the native health SDK. */\n isAvailable(): Promise<AvailabilityResult>;\n /** Requests read/write access to the provided data types. */\n requestAuthorization(options: AuthorizationOptions): Promise<AuthorizationStatus>;\n /** Checks authorization status for the provided data types without prompting the user. */\n checkAuthorization(options: AuthorizationOptions): Promise<AuthorizationStatus>;\n /** Reads samples for the given data type within the specified time frame. */\n readSamples(options: QueryOptions): Promise<ReadSamplesResult>;\n /** Writes a single sample to the native health store. */\n saveSample(options: WriteSampleOptions): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ version: string }>} a Promise with version for this device\n * @throws An error if something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n /**\n * Opens the Health Connect settings screen (Android only).\n * On iOS, this method does nothing.\n *\n * Use this to direct users to manage their Health Connect permissions\n * or to install Health Connect if not available.\n *\n * @throws An error if Health Connect settings cannot be opened\n */\n openHealthConnectSettings(): Promise<void>;\n\n /**\n * Shows the app's privacy policy for Health Connect (Android only).\n * On iOS, this method does nothing.\n *\n * This displays the same privacy policy screen that Health Connect shows\n * when the user taps \"Privacy policy\" in the permissions dialog.\n *\n * The privacy policy URL can be configured by adding a string resource\n * named \"health_connect_privacy_policy_url\" in your app's strings.xml,\n * or by placing an HTML file at www/privacypolicy.html in your assets.\n *\n * @throws An error if the privacy policy cannot be displayed\n */\n showPrivacyPolicy(): Promise<void>;\n\n /**\n * Queries workout sessions from the native health store.\n * Supported on iOS (HealthKit) and Android (Health Connect).\n *\n * @param options Query options including optional workout type filter, date range, limit, and sort order\n * @returns A promise that resolves with the workout sessions\n * @throws An error if something went wrong\n */\n queryWorkouts(options: QueryWorkoutsOptions): Promise<QueryWorkoutsResult>;\n\n /**\n * Queries aggregated health data from the native health store.\n * Aggregates data into time buckets (hour, day, week, month) with operations like sum, average, min, or max.\n * This is more efficient than fetching individual samples for large date ranges.\n *\n * Supported on iOS (HealthKit) and Android (Health Connect).\n *\n * @param options Query options including data type, date range, bucket size, and aggregation type\n * @returns A promise that resolves with the aggregated samples\n * @throws An error if something went wrong\n */\n queryAggregated(options: QueryAggregatedOptions): Promise<QueryAggregatedResult>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type HealthDataType =\n | 'steps'\n | 'distance'\n | 'calories'\n | 'heartRate'\n | 'weight'\n | 'sleep'\n | 'respiratoryRate'\n | 'oxygenSaturation'\n | 'restingHeartRate'\n | 'heartRateVariability'\n | 'bloodPressure'\n | 'bloodGlucose'\n | 'bodyTemperature'\n | 'height'\n | 'flightsClimbed'\n | 'exerciseTime'\n | 'distanceCycling'\n | 'bodyFat'\n | 'basalBodyTemperature'\n | 'basalCalories'\n | 'totalCalories'\n | 'mindfulness';\n\nexport type HealthUnit =\n | 'count'\n | 'meter'\n | 'kilocalorie'\n | 'bpm'\n | 'kilogram'\n | 'minute'\n | 'percent'\n | 'millisecond'\n | 'mmHg'\n | 'mg/dL'\n | 'celsius'\n | 'fahrenheit'\n | 'centimeter';\n\nexport interface AuthorizationOptions {\n /** Data types that should be readable after authorization. */\n read?: HealthDataType[];\n /** Data types that should be writable after authorization. */\n write?: HealthDataType[];\n}\n\nexport interface AuthorizationStatus {\n readAuthorized: HealthDataType[];\n readDenied: HealthDataType[];\n writeAuthorized: HealthDataType[];\n writeDenied: HealthDataType[];\n}\n\nexport interface AvailabilityResult {\n available: boolean;\n /** Platform specific details (for debugging/diagnostics). */\n platform?: 'ios' | 'android' | 'web';\n reason?: string;\n}\n\nexport interface QueryOptions {\n /** The type of data to retrieve from the health store. */\n dataType: HealthDataType;\n /** Inclusive ISO 8601 start date (defaults to now - 1 day). */\n startDate?: string;\n /** Exclusive ISO 8601 end date (defaults to now). */\n endDate?: string;\n /** Maximum number of samples to return (defaults to 100). */\n limit?: number;\n /** Return results sorted ascending by start date (defaults to false). */\n ascending?: boolean;\n}\n\nexport type SleepState = 'inBed' | 'asleep' | 'awake' | 'rem' | 'deep' | 'light';\n\nexport interface HealthSample {\n dataType: HealthDataType;\n value: number;\n unit: HealthUnit;\n startDate: string;\n endDate: string;\n sourceName?: string;\n sourceId?: string;\n /** For sleep data, indicates the sleep state (e.g., 'asleep', 'awake', 'rem', 'deep', 'light'). */\n sleepState?: SleepState;\n /** For blood pressure data, the systolic value in mmHg. */\n systolic?: number;\n /** For blood pressure data, the diastolic value in mmHg. */\n diastolic?: number;\n}\n\nexport interface ReadSamplesResult {\n samples: HealthSample[];\n}\n\nexport type WorkoutType =\n | 'running'\n | 'cycling'\n | 'walking'\n | 'swimming'\n | 'yoga'\n | 'strengthTraining'\n | 'hiking'\n | 'tennis'\n | 'basketball'\n | 'soccer'\n | 'americanFootball'\n | 'baseball'\n | 'crossTraining'\n | 'elliptical'\n | 'rowing'\n | 'stairClimbing'\n | 'traditionalStrengthTraining'\n | 'waterFitness'\n | 'waterPolo'\n | 'waterSports'\n | 'wrestling'\n | 'archery'\n | 'australianFootball'\n | 'badminton'\n | 'barre'\n | 'bowling'\n | 'boxing'\n | 'climbing'\n | 'cooldown'\n | 'coreTraining'\n | 'cricket'\n | 'crossCountrySkiing'\n | 'curling'\n | 'dance'\n | 'discSports'\n | 'downhillSkiing'\n | 'equestrianSports'\n | 'fencing'\n | 'fishing'\n | 'fitnessGaming'\n | 'flexibility'\n | 'functionalStrengthTraining'\n | 'golf'\n | 'gymnastics'\n | 'handball'\n | 'handCycling'\n | 'highIntensityIntervalTraining'\n | 'hockey'\n | 'hunting'\n | 'jumpRope'\n | 'kickboxing'\n | 'lacrosse'\n | 'martialArts'\n | 'mindAndBody'\n | 'mixedCardio'\n | 'paddleSports'\n | 'pickleball'\n | 'pilates'\n | 'play'\n | 'preparationAndRecovery'\n | 'racquetball'\n | 'rugby'\n | 'sailing'\n | 'skatingSports'\n | 'snowboarding'\n | 'snowSports'\n | 'softball'\n | 'squash'\n | 'stairs'\n | 'stepTraining'\n | 'surfingSports'\n | 'tableTennis'\n | 'taiChi'\n | 'trackAndField'\n | 'transition'\n | 'underwaterDiving'\n | 'volleyball'\n | 'wheelchairRunPace'\n | 'wheelchairWalkPace'\n | 'cardioDance'\n | 'socialDance'\n | 'other';\n\nexport interface QueryWorkoutsOptions {\n /** Optional workout type filter. If omitted, all workout types are returned. */\n workoutType?: WorkoutType;\n /** Inclusive ISO 8601 start date (defaults to now - 1 day). */\n startDate?: string;\n /** Exclusive ISO 8601 end date (defaults to now). */\n endDate?: string;\n /** Maximum number of workouts to return (defaults to 100). */\n limit?: number;\n /** Return results sorted ascending by start date (defaults to false). */\n ascending?: boolean;\n /**\n * Anchor for pagination. Use the anchor returned from a previous query to continue from that point.\n * On iOS, this uses HKQueryAnchor. On Android, this uses Health Connect's pageToken.\n * Omit this parameter to start from the beginning.\n */\n anchor?: string;\n}\n\nexport interface Workout {\n /** The type of workout. */\n workoutType: WorkoutType;\n /** Duration of the workout in seconds. */\n duration: number;\n /** Total energy burned in kilocalories (if available). */\n totalEnergyBurned?: number;\n /** Total distance in meters (if available). */\n totalDistance?: number;\n /** ISO 8601 start date of the workout. */\n startDate: string;\n /** ISO 8601 end date of the workout. */\n endDate: string;\n /** Source name that recorded the workout. */\n sourceName?: string;\n /** Source bundle identifier. */\n sourceId?: string;\n /** Additional metadata (if available). */\n metadata?: Record<string, string>;\n}\n\nexport interface QueryWorkoutsResult {\n workouts: Workout[];\n /**\n * Anchor for the next page of results. Pass this value as the anchor parameter in the next query\n * to continue pagination. If undefined or null, there are no more results.\n */\n anchor?: string;\n}\n\nexport interface WriteSampleOptions {\n dataType: HealthDataType;\n value: number;\n /**\n * Optional unit override. If omitted, the default unit for the data type is used\n * (count for `steps`, meter for `distance`, kilocalorie for `calories`, bpm for `heartRate`, kilogram for `weight`).\n */\n unit?: HealthUnit;\n /** ISO 8601 start date for the sample. Defaults to now. */\n startDate?: string;\n /** ISO 8601 end date for the sample. Defaults to startDate. */\n endDate?: string;\n /** Metadata key-value pairs forwarded to the native APIs where supported. */\n metadata?: Record<string, string>;\n /** For blood pressure data, the systolic value in mmHg. Required when dataType is 'bloodPressure'. */\n systolic?: number;\n /** For blood pressure data, the diastolic value in mmHg. Required when dataType is 'bloodPressure'. */\n diastolic?: number;\n}\n\nexport type BucketType = 'hour' | 'day' | 'week' | 'month';\n\nexport type AggregationType = 'sum' | 'average' | 'min' | 'max';\n\nexport interface QueryAggregatedOptions {\n /** The type of data to aggregate from the health store. */\n dataType: HealthDataType;\n /** Inclusive ISO 8601 start date (defaults to now - 1 day). */\n startDate?: string;\n /** Exclusive ISO 8601 end date (defaults to now). */\n endDate?: string;\n /** Time bucket for aggregation (defaults to 'day'). */\n bucket?: BucketType;\n /** Aggregation operation to perform (defaults to 'sum'). */\n aggregation?: AggregationType;\n}\n\nexport interface AggregatedSample {\n /** ISO 8601 start date of the bucket. */\n startDate: string;\n /** ISO 8601 end date of the bucket. */\n endDate: string;\n /** Aggregated value for the bucket. */\n value: number;\n /** Unit of the aggregated value. */\n unit: HealthUnit;\n}\n\nexport interface QueryAggregatedResult {\n samples: AggregatedSample[];\n}\n\nexport interface HealthPlugin {\n /** Returns whether the current platform supports the native health SDK. */\n isAvailable(): Promise<AvailabilityResult>;\n /** Requests read/write access to the provided data types. */\n requestAuthorization(options: AuthorizationOptions): Promise<AuthorizationStatus>;\n /** Checks authorization status for the provided data types without prompting the user. */\n checkAuthorization(options: AuthorizationOptions): Promise<AuthorizationStatus>;\n /** Reads samples for the given data type within the specified time frame. */\n readSamples(options: QueryOptions): Promise<ReadSamplesResult>;\n /** Writes a single sample to the native health store. */\n saveSample(options: WriteSampleOptions): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ version: string }>} a Promise with version for this device\n * @throws An error if something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n /**\n * Opens the Health Connect settings screen (Android only).\n * On iOS, this method does nothing.\n *\n * Use this to direct users to manage their Health Connect permissions\n * or to install Health Connect if not available.\n *\n * @throws An error if Health Connect settings cannot be opened\n */\n openHealthConnectSettings(): Promise<void>;\n\n /**\n * Shows the app's privacy policy for Health Connect (Android only).\n * On iOS, this method does nothing.\n *\n * This displays the same privacy policy screen that Health Connect shows\n * when the user taps \"Privacy policy\" in the permissions dialog.\n *\n * The privacy policy URL can be configured by adding a string resource\n * named \"health_connect_privacy_policy_url\" in your app's strings.xml,\n * or by placing an HTML file at www/privacypolicy.html in your assets.\n *\n * @throws An error if the privacy policy cannot be displayed\n */\n showPrivacyPolicy(): Promise<void>;\n\n /**\n * Queries workout sessions from the native health store.\n * Supported on iOS (HealthKit) and Android (Health Connect).\n *\n * @param options Query options including optional workout type filter, date range, limit, and sort order\n * @returns A promise that resolves with the workout sessions\n * @throws An error if something went wrong\n */\n queryWorkouts(options: QueryWorkoutsOptions): Promise<QueryWorkoutsResult>;\n\n /**\n * Queries aggregated health data from the native health store.\n * Aggregates data into time buckets (hour, day, week, month) with operations like sum, average, min, or max.\n * This is more efficient than fetching individual samples for large date ranges.\n *\n * Supported on iOS (HealthKit) and Android (Health Connect).\n *\n * @param options Query options including data type, date range, bucket size, and aggregation type\n * @returns A promise that resolves with the aggregated samples\n * @throws An error if something went wrong\n */\n queryAggregated(options: QueryAggregatedOptions): Promise<QueryAggregatedResult>;\n}\n"]}
|