forked from lucaspbordignon/rn-apple-healthkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
253 lines (222 loc) · 6.37 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
declare module 'rn-apple-healthkit' {
export interface HealthKitPermissions {
permissions: {
read: HealthPermission[]
write: HealthPermission[]
}
}
export interface AppleHealthKit {
initHealthKit(
permissions: HealthKitPermissions,
callback: (error: string, result: any) => void
): void
saveHeartRate(
sample: { value: number, hasArrhythmia: boolean, date?: string, syncId?: string },
callback: (error: string, result: any) => void
): void
saveBloodPressure(
sample: HealthNewBloodPressureSample,
callback: (error: string, result: any) => void
): void
deleteBloodPressureSample(sampleId: string, callback: (error: string, result: any) => void)
isAvailable(callback: (error: any, results: boolean) => void): void
getLatestHeight(
options: HealthUnitOptions,
callback: (err: string, results: HealthValue) => void
): void
saveHeight(
options: { value: number; unit: HealthUnit},
callback: (error: string, result: any) => void
): voidk
getLatestWeight(
options: HealthUnitOptions,
callback: (err: string, results: HealthValue) => void
): void
saveWeight(
options: { value: number; unit: HealthUnit},
callback: (error: string, result: any) => void
): voidk
getHeartRateSamples(
options: HealthBloodPressureQuery,
callback: (err: any, results: HealthHeartRateResult[]) => void
): void
getBloodPressureSamples(
options: HealthBloodPressureQuery,
callback: (err: any, results: HealthBloodPressureResult[]) => void
): void
getBiologicalSex(
input: null,
callback: (err: any, result: HealthBiologicalSexResult) => void
): void
getDateOfBirth(
input: null,
callback: (err: any, result: HealthDateOfBirth) => void
): void
getSleepSamples(
query: HealthGenericQuery,
callback: (err: any, result: HealthValue[]) => void
)
getDailyStepCountSamples(
query: HealthGenericQuery,
callback: (err: any, result: HealthValue[]) => void
)
checkWritePermissions(callback: (err: any, result: HealthWritePermissions) => void)
Constants: {
Permissions: { [key in keyof HealthPermission]: HealthPermission }
Units: { [key in keyof HealthUnit]: HealthUnit }
}
}
export interface HealthDateOfBirth {
value: string
age: number
}
export interface HealthValue {
value: number
startDate: string
endDate: string
}
export interface HealthUnitOptions {
unit: HealthUnit
}
export interface HealthBloodPressureQuery {
unit?: HealthUnit
startDate: string // required
endDate?: string // optional; default now
ascending?: boolean // optional; default false
limit?: number // optional; default no limit
}
export interface HealthGenericQuery {
startDate: string // required
endDate?: string // optional; default now
limit?: number // optional; default no limit
}
export interface HealthNewBloodPressureSample {
sys: number
dia: number
date?: string
syncId?: string
location?: {latitude: number, longitude: number} | null
hand: "left" | "right"
isTakingMedications: boolean
}
export interface HealthBloodPressureResult {
id: string
systolic: number
diastolic: number
startDate: string
endDate: string
metadata?: { [key: string]: any }
source: string
}
export interface HealthHeartRateResult {
id: string
value: number
startDate: string
endDate: string
metadata?: { [key: string]: any }
source: string
}
export interface HealthWritePermissions {
systolic: boolean
diastolic: boolean
heartRate: boolean
}
export interface HealthBiologicalSexResult {
value: 'unknown' | 'male' | 'female' | 'other'
}
export type HealthUnit = {
bpm: 'bpm'
calorie: 'calorie'
celsius: 'celsius'
count: 'count'
day: 'day'
fahrenheit: 'fahrenheit'
foot: 'foot'
gram: 'gram'
hour: 'hour'
inch: 'inch'
joule: 'joule'
meter: 'meter'
cm: 'cm'
mgPerdL: 'mgPerdL'
mile: 'mile'
minute: 'minute'
mmhg: 'mmhg'
mmolPerL: 'mmolPerL'
percent: 'percent'
pound: 'pound'
kilogram: 'kg'
second: 'second'
}
export type HealthPermission = {
ActiveEnergyBurned: 'ActiveEnergyBurned'
AppleExerciseTime: 'AppleExerciseTime'
BasalEnergyBurned: 'BasalEnergyBurned'
BiologicalSex: 'BiologicalSex'
BloodGlucose: 'BloodGlucose'
BloodPressureDiastolic: 'BloodPressureDiastolic'
BloodPressureSystolic: 'BloodPressureSystolic'
BodyFatPercentage: 'BodyFatPercentage'
BodyMass: 'BodyMass'
BodyMassIndex: 'BodyMassIndex'
BodyTemperature: 'BodyTemperature'
DateOfBirth: 'DateOfBirth'
Biotin: 'Biotin'
Caffeine: 'Caffeine'
Calcium: 'Calcium'
Carbohydrates: 'Carbohydrates'
Chloride: 'Chloride'
Cholesterol: 'Cholesterol'
Copper: 'Copper'
EnergyConsumed: 'EnergyConsumed'
FatMonounsaturated: 'FatMonounsaturated'
FatPolyunsaturated: 'FatPolyunsaturated'
FatSaturated: 'FatSaturated'
FatTotal: 'FatTotal'
Fiber: 'Fiber'
Folate: 'Folate'
Iodine: 'Iodine'
Iron: 'Iron'
Magnesium: 'Magnesium'
Manganese: 'Manganese'
Molybdenum: 'Molybdenum'
Niacin: 'Niacin'
PantothenicAcid: 'PantothenicAcid'
Phosphorus: 'Phosphorus'
Potassium: 'Potassium'
Protein: 'Protein'
Riboflavin: 'Riboflavin'
Selenium: 'Selenium'
Sodium: 'Sodium'
Sugar: 'Sugar'
Thiamin: 'Thiamin'
VitaminA: 'VitaminA'
VitaminB12: 'VitaminB12'
VitaminB6: 'VitaminB6'
VitaminC: 'VitaminC'
VitaminD: 'VitaminD'
VitaminE: 'VitaminE'
VitaminK: 'VitaminK'
Zinc: 'Zinc'
Water: 'Water'
DistanceCycling: 'DistanceCycling'
DistanceWalkingRunning: 'DistanceWalkingRunning'
FlightsClimbed: 'FlightsClimbed'
HeartRate: 'HeartRate'
Height: 'Height'
LeanBodyMass: 'LeanBodyMass'
MindfulSession: 'MindfulSession'
NikeFuel: 'NikeFuel'
RespiratoryRate: 'RespiratoryRate'
SleepAnalysis: 'SleepAnalysis'
StepCount: 'StepCount'
Steps: 'Steps'
Weight: 'Weight'
}
const appleHealthKit: AppleHealthKit
export default appleHealthKit
export const HealthKitPermissions: {
[key in keyof HealthPermission]: HealthPermission
}
export const HealthKitUnits: { [key in keyof HealthUnit]: HealthUnit }
}