Skip to content

Commit b730116

Browse files
committed
interface finetuning
1 parent 5d72bd1 commit b730116

File tree

2 files changed

+61
-48
lines changed

2 files changed

+61
-48
lines changed

src/types/oura.ts

Lines changed: 59 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,27 @@ export interface DailyActivity {
5656
* 4 medium activity
5757
* 5 high activity
5858
*/
59-
class_5_min: string;
59+
class_5_min: string | null;
6060
/** Activity score in range [1, 100] */
61-
score: number;
61+
score: number | null;
6262
/** Active calories expended (in kilocalories) */
6363
active_calories: number;
6464
/** Average metabolic equivalent (MET) in minutes */
6565
average_met_minutes: number;
6666
/** Object defining activity score contributors */
6767
contributors: {
6868
/** Contribution of meeting previous 7-day daily activity targets in range [1, 100] */
69-
meet_daily_targets: number;
69+
meet_daily_targets: number | null;
7070
/** Contribution of previous 24-hour inactivity alerts in range [1, 100] */
71-
move_every_hour: number;
71+
move_every_hour: number | null;
7272
/** Contribution of previous 7-day recovery time in range [1, 100] */
73-
recovery_time: number;
73+
recovery_time: number | null;
7474
/** Contribution of previous 24-hour activity in range [1, 100] */
75-
stay_active: number;
75+
stay_active: number | null;
7676
/** Contribution of previous 7-day exercise frequency in range [1, 100] */
77-
training_frequency: number;
77+
training_frequency: number | null;
7878
/** Contribution of previous 7-day exercise volume in range [1, 100] */
79-
training_volume: number;
79+
training_volume: number | null;
8080
};
8181
/** Equivalent walking distance (in meters) of energy expenditure */
8282
equivalent_walking_distance: number;
@@ -129,34 +129,37 @@ export interface DailyReadiness {
129129
/** Object defining readiness score contributors */
130130
contributors: {
131131
/** Contribution of cumulative activity balance in range [1, 100] */
132-
activity_balance: number;
132+
activity_balance: number | null;
133133
/** Contribution of body temperature in range [1, 100] */
134-
body_temperature: number;
134+
body_temperature: number | null;
135135
/** Contribution of heart rate variability balance in range [1, 100] */
136-
hrv_balance: number;
136+
hrv_balance: number | null;
137137
/** Contribution of previous day's activity in range [1, 100] */
138-
previous_day_activity: number;
138+
previous_day_activity: number | null;
139139
/** Contribution of previous night's sleep in range [1, 100] */
140-
previous_night: number;
140+
previous_night: number | null;
141141
/** Contribution of recovery index in range [1, 100] */
142-
recovery_index: number;
142+
recovery_index: number | null;
143143
/** Contribution of resting heart rate in range [1, 100] */
144-
resting_heart_rate: number;
144+
resting_heart_rate: number | null;
145145
/** Contribution of sleep balance in range [1, 100] */
146-
sleep_balance: number;
146+
sleep_balance: number | null;
147147
};
148148
/** Day that the daily readiness belongs to */
149149
day: string;
150150
/** Daily readiness score */
151-
score: number;
151+
score: number | null;
152152
/** Temperature deviation in degrees Celsius */
153-
temperature_deviation: number;
153+
temperature_deviation: number | null;
154154
/** Temperature trend deviation in degrees Celsius */
155-
temperature_trend_deviation: number;
155+
temperature_trend_deviation: number | null;
156156
/** Timestamp of the daily readiness */
157157
timestamp: string;
158158
}
159159

160+
/** Union of possible of daily stress summaries */
161+
export type LongTermResilienceLevel = "limited" | "adequate" | "solid" | "strong" | "exceptional";
162+
160163
/**
161164
* Represents daily resilience metrics provided by the Oura ring.
162165
*/
@@ -172,7 +175,7 @@ export interface DailyResilience {
172175
stress: number;
173176
};
174177
/** level of resilience */
175-
level: string;
178+
level: LongTermResilienceLevel;
176179
}
177180

178181
/**
@@ -184,24 +187,24 @@ export interface DailySleep {
184187
/** Object defining sleep score contributors */
185188
contributors: {
186189
/** Contribution of deep sleep in range [1, 100] */
187-
deep_sleep: number;
190+
deep_sleep: number | null;
188191
/** Contribution of sleep efficiency in range [1, 100] */
189-
efficiency: number;
192+
efficiency: number | null;
190193
/** Contribution of sleep latency in range [1, 100] */
191-
latency: number;
194+
latency: number | null;
192195
/** Contribution of REM sleep in range [1, 100] */
193-
rem_sleep: number;
196+
rem_sleep: number | null;
194197
/** Contribution of sleep restfulness in range [1, 100] */
195-
restfulness: number;
198+
restfulness: number | null;
196199
/** Contribution of sleep timing in range [1, 100] */
197-
timing: number;
200+
timing: number | null;
198201
/** Contribution of total sleep in range [1, 100] */
199-
total_sleep: number;
202+
total_sleep: number | null;
200203
};
201204
/** Day that the daily sleep belongs to. */
202205
day: string;
203206
/** Daily sleep score */
204-
score: number;
207+
score: number | null;
205208
/** Timestamp of the daily sleep */
206209
timestamp: number;
207210
}
@@ -218,7 +221,7 @@ export interface DailySpo2 {
218221
spo2_percentage: {
219222
/** Average oxygen saturation (SpO2) throughout the night */
220223
average: number;
221-
};
224+
} | null;
222225
}
223226

224227
/** Union of Heart Rate sources */
@@ -305,6 +308,11 @@ export interface RingConfiguration {
305308
size: number;
306309
}
307310

311+
/** Union of possible of ring hardware generations */
312+
export type MomentType = "breathing" | "meditation" | "nap" | "relaxation" | "rest" | "body_status";
313+
314+
/** Union of possible of ring hardware generations */
315+
export type MomentMood = "bad" | "worse" | "same" | "good" | "great";
308316
/**
309317
* Represents a recorded activity session tracked by the Oura ring.
310318
*/
@@ -318,13 +326,13 @@ export interface DailySession {
318326
/** Timestamp indicating when the Moment ended */
319327
end_datetime: string;
320328
/** Moment type */
321-
type: string;
329+
type: MomentType;
322330
/** HR samples */
323331
heart_rate: SampleData;
324332
/** HRV samples */
325333
heart_rate_variability: SampleData;
326334
/** Moment mood */
327-
mood: string;
335+
mood: MomentMood;
328336
/** Motion samples */
329337
motion_count: SampleData;
330338
}
@@ -380,21 +388,21 @@ export interface Sleep {
380388
/** Object defining readiness score contributors */
381389
contributors: {
382390
/** Contribution of cumulative activity balance in range [1, 100] */
383-
activity_balance: number;
391+
activity_balance: number | null;
384392
/** Contribution of body temperature in range [1, 100] */
385-
body_temperature: number;
393+
body_temperature: number | null;
386394
/** Contribution of heart rate variability balance in range [1, 100] */
387-
hrv_balance: number;
395+
hrv_balance: number | null;
388396
/** Contribution of previous day's activity in range [1, 100] */
389-
previous_day_activity: number;
397+
previous_day_activity: number | null;
390398
/** Contribution of previous night's sleep in range [1, 100] */
391-
previous_night: number;
399+
previous_night: number | null;
392400
/** Contribution of recovery index in range [1, 100] */
393-
recovery_index: number;
401+
recovery_index: number | null;
394402
/** Contribution of resting heart rate in range [1, 100] */
395-
resting_heart_rate: number;
403+
resting_heart_rate: number | null;
396404
/** Contribution of sleep balance in range [1, 100] */
397-
sleep_balance: number;
405+
sleep_balance: number | null;
398406
};
399407
/** Score */
400408
score: number;
@@ -501,19 +509,24 @@ export interface EnhancedTag {
501509
/** Unique identifier */
502510
id: string;
503511
/** The unique code of the selected tag type, "NULL" for text-only tags, or "custom" for custom tag types */
504-
tag_type_code: string;
512+
tag_type_code: string | null;
505513
/** Timestamp of the tag (if no duration) or the start time of the tag (with duration) */
506514
start_time: string;
507515
/** Timestamp of the tag's end for events with duration or "NULL" if there is no duration */
508-
end_time: string;
516+
end_time: string | null;
509517
/** Day of the tag (if no duration) or the start day of the tag (with duration) */
510518
start_day: string;
511519
/** Day of the tag's end for events with duration or "NULL" if there is no duration */
512-
end_day: string;
520+
end_day: string | null;
513521
/** Additional freeform text on the tag */
514-
comment: string;
522+
comment: string | null;
523+
/** The name of the tag if the tag_type_code is "custom". */
524+
custom_name: string | null;
515525
}
516526

527+
/** Union of possible of daily stress summaries */
528+
export type DailyStressSummary = "restored" | "normal" | "stressful";
529+
517530
/**
518531
* Represents daily strees summary
519532
*/
@@ -523,11 +536,11 @@ export interface DailyStress {
523536
/** Day that the daily stress belongs to */
524537
day: string;
525538
/** Time spent in a high stress zone (top quartile of data) */
526-
stress_high: number;
539+
stress_high: number | null;
527540
/** Time spend in a high recovery zone (bottom quartile data) */
528-
recovery_high: number;
541+
recovery_high: number | null;
529542
/** Stress summary of full day */
530-
day_summary: string;
543+
day_summary: DailyStressSummary | null;
531544
}
532545

533546
/**

src/types/webhook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export interface Subscription {
4343
/** URL where Oura will send webhook notifications */
4444
callback_url: string;
4545
/** The EventType that triggers the webhook (e.g., "create", "update", "delete") */
46-
event_type: string;
46+
event_type: EventType;
4747
/** The DataType the subscription monitors */
48-
data_type: string;
48+
data_type: DataType;
4949
/** The subscription's expiration time */
5050
expiration_time: string;
5151
}

0 commit comments

Comments
 (0)