@robinhealth/health-sdk 0.0.1

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/src/types.ts ADDED
@@ -0,0 +1,189 @@
1
+ export enum HealthDataType {
2
+ Steps = 'Steps',
3
+ DistanceWalkingRunning = 'DistanceWalkingRunning',
4
+ ActiveEnergyBurned = 'ActiveEnergyBurned',
5
+ FlightsClimbed = 'FlightsClimbed',
6
+ HeartRate = 'HeartRate',
7
+ RestingHeartRate = 'RestingHeartRate',
8
+ BloodPressureSystolic = 'BloodPressureSystolic',
9
+ BloodPressureDiastolic = 'BloodPressureDiastolic',
10
+ BloodOxygen = 'BloodOxygen',
11
+ RespiratoryRate = 'RespiratoryRate',
12
+ SleepAnalysis = 'SleepAnalysis',
13
+ // Tier 2 — Body Composition
14
+ BodyFatPercentage = 'BodyFatPercentage',
15
+ BodyMassIndex = 'BodyMassIndex',
16
+ BasalEnergyBurned = 'BasalEnergyBurned',
17
+ // Tier 3 — Supplementary
18
+ Water = 'Water',
19
+ }
20
+
21
+ export enum PermissionStatus {
22
+ GRANTED = 'GRANTED',
23
+ DECLINED = 'DECLINED',
24
+ UNKNOWN = 'UNKNOWN',
25
+ }
26
+
27
+ export enum SleepStage {
28
+ Awake = 'awake',
29
+ Light = 'light',
30
+ Deep = 'deep',
31
+ REM = 'rem',
32
+ Unknown = 'unknown',
33
+ }
34
+
35
+ export enum WorkoutActivityType {
36
+ americanFootball = 'americanFootball',
37
+ archery = 'archery',
38
+ australianFootball = 'australianFootball',
39
+ badminton = 'badminton',
40
+ baseball = 'baseball',
41
+ basketball = 'basketball',
42
+ bowling = 'bowling',
43
+ boxing = 'boxing',
44
+ climbing = 'climbing',
45
+ cricket = 'cricket',
46
+ crossTraining = 'crossTraining',
47
+ curling = 'curling',
48
+ cycling = 'cycling',
49
+ dance = 'dance',
50
+ danceInspiredTraining = 'danceInspiredTraining',
51
+ elliptical = 'elliptical',
52
+ equestrianSports = 'equestrianSports',
53
+ fencing = 'fencing',
54
+ fishing = 'fishing',
55
+ functionalStrengthTraining = 'functionalStrengthTraining',
56
+ golf = 'golf',
57
+ gymnastics = 'gymnastics',
58
+ handball = 'handball',
59
+ hiking = 'hiking',
60
+ hockey = 'hockey',
61
+ hunting = 'hunting',
62
+ lacrosse = 'lacrosse',
63
+ martialArts = 'martialArts',
64
+ mindAndBody = 'mindAndBody',
65
+ mixedMetabolicCardioTraining = 'mixedMetabolicCardioTraining',
66
+ paddleSports = 'paddleSports',
67
+ play = 'play',
68
+ preparationAndRecovery = 'preparationAndRecovery',
69
+ racquetball = 'racquetball',
70
+ rowing = 'rowing',
71
+ rugby = 'rugby',
72
+ running = 'running',
73
+ sailing = 'sailing',
74
+ skatingSports = 'skatingSports',
75
+ snowSports = 'snowSports',
76
+ soccer = 'soccer',
77
+ softball = 'softball',
78
+ squash = 'squash',
79
+ stairClimbing = 'stairClimbing',
80
+ surfingSports = 'surfingSports',
81
+ swimming = 'swimming',
82
+ tableTennis = 'tableTennis',
83
+ tennis = 'tennis',
84
+ trackAndField = 'trackAndField',
85
+ traditionalStrengthTraining = 'traditionalStrengthTraining',
86
+ volleyball = 'volleyball',
87
+ walking = 'walking',
88
+ waterFitness = 'waterFitness',
89
+ waterPolo = 'waterPolo',
90
+ waterSports = 'waterSports',
91
+ wrestling = 'wrestling',
92
+ yoga = 'yoga',
93
+ barre = 'barre',
94
+ coreTraining = 'coreTraining',
95
+ crossCountrySkiing = 'crossCountrySkiing',
96
+ downhillSkiing = 'downhillSkiing',
97
+ flexibility = 'flexibility',
98
+ highIntensityIntervalTraining = 'highIntensityIntervalTraining',
99
+ jumpRope = 'jumpRope',
100
+ kickboxing = 'kickboxing',
101
+ pilates = 'pilates',
102
+ snowboarding = 'snowboarding',
103
+ stairs = 'stairs',
104
+ stepTraining = 'stepTraining',
105
+ wheelchairWalkPace = 'wheelchairWalkPace',
106
+ wheelchairRunPace = 'wheelchairRunPace',
107
+ taiChi = 'taiChi',
108
+ mixedCardio = 'mixedCardio',
109
+ handCycling = 'handCycling',
110
+ discSports = 'discSports',
111
+ fitnessGaming = 'fitnessGaming',
112
+ cardioDance = 'cardioDance',
113
+ socialDance = 'socialDance',
114
+ pickleball = 'pickleball',
115
+ cooldown = 'cooldown',
116
+ swimBikeRun = 'swimBikeRun',
117
+ transition = 'transition',
118
+ underwaterDiving = 'underwaterDiving',
119
+ other = 'other',
120
+ }
121
+
122
+ export interface Workout {
123
+ workoutType: WorkoutActivityType;
124
+ duration: number;
125
+ energyBurned: number | null;
126
+ distance: number | null;
127
+ heartRateAvg: number | null;
128
+ heartRateMax: number | null;
129
+ startDate: Date;
130
+ endDate: Date;
131
+ sourceName: string;
132
+ }
133
+
134
+ export interface HealthSample {
135
+ type: HealthDataType;
136
+ value: number;
137
+ unit: string;
138
+ startDate: Date;
139
+ endDate: Date;
140
+ sourceName?: string;
141
+ }
142
+
143
+ export interface SleepStageSample extends HealthSample {
144
+ stage: SleepStage;
145
+ }
146
+
147
+ export interface SleepSession {
148
+ startDate: Date;
149
+ endDate: Date;
150
+ totalDuration: number;
151
+ stages: {
152
+ awake: number;
153
+ light: number;
154
+ deep: number;
155
+ rem: number;
156
+ unknown: number;
157
+ };
158
+ sourceName: string;
159
+ }
160
+
161
+ export interface HealthAggregate {
162
+ type: HealthDataType;
163
+ sum?: number;
164
+ avg?: number;
165
+ min?: number;
166
+ max?: number;
167
+ unit: string;
168
+ startDate: Date;
169
+ endDate: Date;
170
+ }
171
+
172
+ export interface HealthProvider {
173
+ isAvailable(): Promise<boolean>;
174
+ shouldRequestAuthorization(dataTypes: HealthDataType[]): Promise<boolean>;
175
+ requestAuthorization(dataTypes: HealthDataType[]): Promise<boolean>;
176
+ getPermissionStatus(): Promise<PermissionStatus>;
177
+ querySamples(
178
+ type: HealthDataType,
179
+ startDate: Date,
180
+ endDate: Date,
181
+ ): Promise<HealthSample[]>;
182
+ queryAggregated(
183
+ type: HealthDataType,
184
+ startDate: Date,
185
+ endDate: Date,
186
+ ): Promise<HealthAggregate>;
187
+ queryWorkouts(startDate: Date, endDate: Date): Promise<Workout[]>;
188
+ querySleepSessions(startDate: Date, endDate: Date): Promise<SleepSession[]>;
189
+ }