forked from lucaspbordignon/rn-apple-healthkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
186 lines (171 loc) · 4.09 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
declare module "rn-apple-healthkit" {
export interface HealthKitPermissions {
permissions: {
read: string[];
write: string[];
};
}
export interface MindfulSessionData {
startDate?: Date;
endDate?: Date;
limit?: number;
}
export enum HealthActivity {
americanFootball = 1,
archery = 2,
australianFootball = 3,
badminton = 4,
baseball = 5,
basketball = 6,
bowling = 7,
boxing = 8,
climbing = 9,
cricket = 10,
crossTraining = 11,
curling = 12,
cycling = 13,
dance = 14,
elliptical = 16,
equestrianSports = 17,
fencing = 18,
fishing = 19,
functionalStrengthTraining = 20,
golf = 21,
gymnastics = 22,
handball = 23,
hiking = 24,
hockey = 25,
hunting = 26,
lacrosse = 27,
martialArts = 28,
mindAndBody = 29,
paddleSports = 31,
play = 32,
preparationAndRecovery = 33,
racquetball = 34,
rowing = 35,
rugby = 36,
running = 37,
sailing = 38,
skatingSports = 39,
snowSports = 40,
soccer = 41,
softball = 42,
squash = 43,
stairClimbing = 44,
surfingSports = 45,
swimming = 46,
tableTennis = 47,
tennis = 48,
trackAndField = 49,
traditionalStrengthTraining = 50,
volleyball = 51,
walking = 52,
waterFitness = 53,
waterPolo = 54,
waterSports = 55,
wrestling = 56,
yoga = 57,
barre = 58,
coreTraining = 59,
crossCountrySkiing = 60,
downhillSkiing = 61,
flexibility = 62,
highIntensityIntervalTraining = 63,
jumpRope = 64,
kickboxing = 65,
pilates = 66,
snowboarding = 67,
stairs = 68,
stepTraining = 69,
wheelchairWalkPace = 70,
wheelchairRunPace = 71,
taiChi = 72,
mixedCardio = 73,
handCycling = 74,
discSports = 75,
fitnessGaming = 76,
other = 3000,
}
export interface WorkoutOptions {
type?: HealthActivity; // default = core training
startDate?: string; // ISO date
endDate?: string; // ISO date
duration?: number; // default = 0
energyBurned?: number; // default = 0
energyBurnedUnit?: HealthUnit; // default = kilocalorie
totalDistance?: number; // default = 0
totalDistanceUnit?: HealthUnit; // default = meter
}
export interface AppleHealthKit {
initHealthKit(
permissions: HealthKitPermissions,
callback: (error: string, result: Object) => void
): void;
saveFood(
options: Object,
callback: (error: string, result: Object) => void
): void;
isAvailable(callback: (error: Object, results: boolean) => void): void;
getDateOfBirth(
options: any,
callback: (error: Object, results: HealthDateOfBirth) => void
): void;
getLatestHeight(
options: HealthUnitOptions,
callback: (err: string, results: HealthValue) => void
): void;
getLatestWeight(
options: HealthUnitOptions,
callback: (err: string, results: HealthValue) => void
): void;
getMindfulSession(
options: MindfulSessionData,
callback: (err: string, results: HealthValue) => void
): void;
getStepCount(
options: any,
callback: (err: string, results: HealthValue) => void
): void;
saveWorkout(
options: WorkoutOptions,
onSave: (error?: Error, response?: { success: boolean }) => void
): void;
}
export interface HealthDateOfBirth {
value: string;
age: number;
}
export interface HealthValue {
value: number;
startDate: string;
endDate: string;
}
export interface HealthUnitOptions {
unit: HealthUnit;
}
export enum 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",
mgPerdL = "mgPerdL",
mile = "mile",
minute = "minute",
mmhg = "mmhg",
mmolPerL = "mmolPerL",
percent = "percent",
pound = "pound",
second = "second",
}
const appleHealthKit: AppleHealthKit;
export default appleHealthKit;
}