@openlifelog/sdk 1.0.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/EXAMPLES.md +624 -0
- package/README.md +824 -0
- package/client.ts +190 -0
- package/config.ts +96 -0
- package/constants/metrics.ts +116 -0
- package/dist/index.d.mts +1101 -0
- package/dist/index.d.ts +1101 -0
- package/dist/index.js +2023 -0
- package/dist/index.mjs +1969 -0
- package/index.ts +49 -0
- package/package.json +53 -0
- package/resources/ai.ts +26 -0
- package/resources/auth.ts +98 -0
- package/resources/exercises.ts +112 -0
- package/resources/food-logs.ts +132 -0
- package/resources/foods.ts +185 -0
- package/resources/goals.ts +155 -0
- package/resources/metrics.ts +115 -0
- package/resources/programs.ts +123 -0
- package/resources/sessions.ts +142 -0
- package/resources/users.ts +132 -0
- package/resources/workouts.ts +147 -0
- package/tsconfig.json +27 -0
- package/types/ai.ts +55 -0
- package/types/common.ts +177 -0
- package/types/exercise.ts +75 -0
- package/types/food.ts +208 -0
- package/types/goal.ts +169 -0
- package/types/index.ts +17 -0
- package/types/metric.ts +108 -0
- package/types/program.ts +120 -0
- package/types/session.ts +196 -0
- package/types/user.ts +79 -0
- package/types/workout.ts +97 -0
- package/utils/errors.ts +159 -0
- package/utils/http.ts +313 -0
- package/utils/index.ts +8 -0
- package/utils/pagination.ts +106 -0
- package/utils/units.ts +279 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1101 @@
|
|
|
1
|
+
type MeasurementSystem = 'metric' | 'imperial';
|
|
2
|
+
type DateTime = string;
|
|
3
|
+
type DateString = string;
|
|
4
|
+
type UUID = string;
|
|
5
|
+
interface PageInfo {
|
|
6
|
+
nextCursor?: string;
|
|
7
|
+
hasMore: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ListResponse<T> {
|
|
10
|
+
data: T[];
|
|
11
|
+
pageInfo: PageInfo;
|
|
12
|
+
}
|
|
13
|
+
interface ListParams {
|
|
14
|
+
limit?: number;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}
|
|
17
|
+
interface DateRangeParams {
|
|
18
|
+
startDate?: DateString;
|
|
19
|
+
endDate?: DateString;
|
|
20
|
+
}
|
|
21
|
+
interface SearchParams extends ListParams {
|
|
22
|
+
search?: string;
|
|
23
|
+
q?: string;
|
|
24
|
+
}
|
|
25
|
+
interface CountResponse {
|
|
26
|
+
count: number;
|
|
27
|
+
}
|
|
28
|
+
interface SuccessResponse<T = any> {
|
|
29
|
+
success: boolean;
|
|
30
|
+
data?: T;
|
|
31
|
+
message?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ErrorResponse {
|
|
34
|
+
error: string;
|
|
35
|
+
message?: string;
|
|
36
|
+
code?: number;
|
|
37
|
+
}
|
|
38
|
+
type MealType = 'breakfast' | 'lunch' | 'dinner' | 'snack';
|
|
39
|
+
type SessionStatus = 'planned' | 'in_progress' | 'completed' | 'abandoned' | 'paused';
|
|
40
|
+
type GoalTargetType = 'exact' | 'min' | 'max';
|
|
41
|
+
type NutritionGoalType = 'exact' | 'range' | 'min' | 'max';
|
|
42
|
+
type ExerciseCategory = 'strength' | 'cardio' | 'flexibility' | 'sport' | 'other';
|
|
43
|
+
type MovementPattern = 'compound' | 'isolation' | 'unilateral' | 'bilateral';
|
|
44
|
+
type ForceDirection = 'push' | 'pull' | 'static' | 'dynamic';
|
|
45
|
+
type WorkoutFormat = 'straight_sets' | 'superset' | 'circuit' | 'pyramid' | 'drop_set' | 'rest_pause' | 'emom';
|
|
46
|
+
type MuscleGroup = 'chest' | 'back' | 'shoulders' | 'biceps' | 'triceps' | 'forearms' | 'abs' | 'obliques' | 'quadriceps' | 'hamstrings' | 'glutes' | 'calves' | 'traps' | 'lats' | 'front_delts' | 'side_delts' | 'rear_delts';
|
|
47
|
+
type Equipment = 'barbell' | 'dumbbell' | 'kettlebell' | 'machine' | 'cable' | 'bodyweight' | 'resistance_band' | 'bench' | 'rack' | 'pull_up_bar';
|
|
48
|
+
type RecordType = 'weight' | 'reps' | 'volume' | 'distance' | 'duration';
|
|
49
|
+
|
|
50
|
+
interface User {
|
|
51
|
+
id: UUID;
|
|
52
|
+
name: string;
|
|
53
|
+
email: string;
|
|
54
|
+
emailVerified: boolean;
|
|
55
|
+
isActive: boolean;
|
|
56
|
+
isOnboarded: boolean;
|
|
57
|
+
timezone: string;
|
|
58
|
+
locale: string;
|
|
59
|
+
dateFormat: string;
|
|
60
|
+
createdAt: DateTime;
|
|
61
|
+
updatedAt: DateTime;
|
|
62
|
+
}
|
|
63
|
+
interface UserPreferences {
|
|
64
|
+
userId: UUID;
|
|
65
|
+
measurementSystem: MeasurementSystem;
|
|
66
|
+
createdAt: DateTime;
|
|
67
|
+
updatedAt: DateTime;
|
|
68
|
+
}
|
|
69
|
+
interface SignupRequest {
|
|
70
|
+
name: string;
|
|
71
|
+
email: string;
|
|
72
|
+
password: string;
|
|
73
|
+
}
|
|
74
|
+
interface LoginRequest {
|
|
75
|
+
email: string;
|
|
76
|
+
password: string;
|
|
77
|
+
}
|
|
78
|
+
interface AuthResponse {
|
|
79
|
+
token: string;
|
|
80
|
+
user: User;
|
|
81
|
+
}
|
|
82
|
+
interface PasswordResetRequest {
|
|
83
|
+
email: string;
|
|
84
|
+
}
|
|
85
|
+
interface PasswordResetConfirm {
|
|
86
|
+
token: string;
|
|
87
|
+
newPassword: string;
|
|
88
|
+
}
|
|
89
|
+
interface UpdateUserRequest {
|
|
90
|
+
name?: string;
|
|
91
|
+
isOnboarded?: boolean;
|
|
92
|
+
timezone?: string;
|
|
93
|
+
locale?: string;
|
|
94
|
+
dateFormat?: string;
|
|
95
|
+
}
|
|
96
|
+
interface UpdatePreferencesRequest {
|
|
97
|
+
measurementSystem?: MeasurementSystem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface NutritionalInformation {
|
|
101
|
+
calories: number;
|
|
102
|
+
protein: number;
|
|
103
|
+
carbohydrates: number;
|
|
104
|
+
fat: number;
|
|
105
|
+
fiber?: number;
|
|
106
|
+
sugar?: number;
|
|
107
|
+
saturatedFat?: number;
|
|
108
|
+
transFat?: number;
|
|
109
|
+
cholesterol?: number;
|
|
110
|
+
sodium?: number;
|
|
111
|
+
potassium?: number;
|
|
112
|
+
calcium?: number;
|
|
113
|
+
iron?: number;
|
|
114
|
+
vitaminA?: number;
|
|
115
|
+
vitaminC?: number;
|
|
116
|
+
vitaminD?: number;
|
|
117
|
+
vitaminE?: number;
|
|
118
|
+
vitaminK?: number;
|
|
119
|
+
vitaminB6?: number;
|
|
120
|
+
vitaminB12?: number;
|
|
121
|
+
thiamin?: number;
|
|
122
|
+
riboflavin?: number;
|
|
123
|
+
niacin?: number;
|
|
124
|
+
folate?: number;
|
|
125
|
+
magnesium?: number;
|
|
126
|
+
phosphorus?: number;
|
|
127
|
+
zinc?: number;
|
|
128
|
+
copper?: number;
|
|
129
|
+
manganese?: number;
|
|
130
|
+
selenium?: number;
|
|
131
|
+
alanine?: number;
|
|
132
|
+
arginine?: number;
|
|
133
|
+
asparticAcid?: number;
|
|
134
|
+
cysteine?: number;
|
|
135
|
+
glutamicAcid?: number;
|
|
136
|
+
glycine?: number;
|
|
137
|
+
histidine?: number;
|
|
138
|
+
isoleucine?: number;
|
|
139
|
+
leucine?: number;
|
|
140
|
+
lysine?: number;
|
|
141
|
+
methionine?: number;
|
|
142
|
+
phenylalanine?: number;
|
|
143
|
+
proline?: number;
|
|
144
|
+
serine?: number;
|
|
145
|
+
threonine?: number;
|
|
146
|
+
tryptophan?: number;
|
|
147
|
+
tyrosine?: number;
|
|
148
|
+
valine?: number;
|
|
149
|
+
}
|
|
150
|
+
interface ServingSize {
|
|
151
|
+
name: string;
|
|
152
|
+
grams: number;
|
|
153
|
+
isDefault: boolean;
|
|
154
|
+
}
|
|
155
|
+
interface Food {
|
|
156
|
+
id: UUID;
|
|
157
|
+
name: string;
|
|
158
|
+
description?: string;
|
|
159
|
+
brand?: string;
|
|
160
|
+
barcodeUpc?: string;
|
|
161
|
+
barcodeEan?: string;
|
|
162
|
+
barcodeGtin?: string;
|
|
163
|
+
barcodeOther?: string;
|
|
164
|
+
type: 'food' | 'beverage' | 'meal';
|
|
165
|
+
nutrients: NutritionalInformation;
|
|
166
|
+
servingSizes: ServingSize[];
|
|
167
|
+
calories: number;
|
|
168
|
+
protein: number;
|
|
169
|
+
carbs: number;
|
|
170
|
+
fat: number;
|
|
171
|
+
createdAt: DateTime;
|
|
172
|
+
updatedAt: DateTime;
|
|
173
|
+
}
|
|
174
|
+
interface CreateFoodRequest {
|
|
175
|
+
name: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
brand?: string;
|
|
178
|
+
barcodeUpc?: string;
|
|
179
|
+
barcodeEan?: string;
|
|
180
|
+
barcodeGtin?: string;
|
|
181
|
+
barcodeOther?: string;
|
|
182
|
+
type?: 'food' | 'beverage' | 'meal';
|
|
183
|
+
nutrients: NutritionalInformation;
|
|
184
|
+
servingSizes: Omit<ServingSize, 'id'>[];
|
|
185
|
+
}
|
|
186
|
+
type UpdateFoodRequest = Partial<CreateFoodRequest>;
|
|
187
|
+
interface ListFoodsParams extends SearchParams {
|
|
188
|
+
search?: string;
|
|
189
|
+
}
|
|
190
|
+
interface FoodLog {
|
|
191
|
+
id: UUID;
|
|
192
|
+
userId: UUID;
|
|
193
|
+
foodId: UUID;
|
|
194
|
+
name: string;
|
|
195
|
+
servingSizeName?: string;
|
|
196
|
+
quantity: number;
|
|
197
|
+
unitGrams: number;
|
|
198
|
+
totalGrams: number;
|
|
199
|
+
nutrients: Record<string, number>;
|
|
200
|
+
mealType?: MealType;
|
|
201
|
+
loggedAt: DateTime;
|
|
202
|
+
notes?: string;
|
|
203
|
+
createdAt: DateTime;
|
|
204
|
+
foodName?: string;
|
|
205
|
+
foodBrand?: string;
|
|
206
|
+
}
|
|
207
|
+
interface CreateFoodLogRequest {
|
|
208
|
+
foodId: UUID;
|
|
209
|
+
name: string;
|
|
210
|
+
servingSizeName?: string;
|
|
211
|
+
quantity: number;
|
|
212
|
+
unitGrams: number;
|
|
213
|
+
mealType?: MealType;
|
|
214
|
+
loggedAt?: DateTime;
|
|
215
|
+
notes?: string;
|
|
216
|
+
}
|
|
217
|
+
type UpdateFoodLogRequest = Partial<CreateFoodLogRequest>;
|
|
218
|
+
interface ListFoodLogsParams extends ListParams, DateRangeParams {
|
|
219
|
+
date?: DateString;
|
|
220
|
+
mealType?: MealType;
|
|
221
|
+
}
|
|
222
|
+
interface DailyNutritionSummary {
|
|
223
|
+
date: DateString;
|
|
224
|
+
mealType?: MealType;
|
|
225
|
+
totalCalories: number;
|
|
226
|
+
totalProtein: number;
|
|
227
|
+
totalCarbs: number;
|
|
228
|
+
totalFat: number;
|
|
229
|
+
itemCount: number;
|
|
230
|
+
nutrients?: Record<string, number>;
|
|
231
|
+
}
|
|
232
|
+
interface GetDailySummaryParams {
|
|
233
|
+
date?: DateString;
|
|
234
|
+
mealType?: MealType;
|
|
235
|
+
}
|
|
236
|
+
interface QuickEntryFoodLogRequest {
|
|
237
|
+
name: string;
|
|
238
|
+
calories?: number;
|
|
239
|
+
protein?: number;
|
|
240
|
+
carbohydrates?: number;
|
|
241
|
+
fat?: number;
|
|
242
|
+
mealType?: MealType;
|
|
243
|
+
loggedAt?: DateTime;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface ExerciseCapabilities {
|
|
247
|
+
supportsWeight: boolean;
|
|
248
|
+
supportsBodyweightOnly: boolean;
|
|
249
|
+
supportsAssistance: boolean;
|
|
250
|
+
supportsDistance: boolean;
|
|
251
|
+
supportsDuration: boolean;
|
|
252
|
+
supportsTempo: boolean;
|
|
253
|
+
}
|
|
254
|
+
interface Exercise {
|
|
255
|
+
id: UUID;
|
|
256
|
+
name: string;
|
|
257
|
+
description?: string;
|
|
258
|
+
category: ExerciseCategory | string;
|
|
259
|
+
exerciseType?: string;
|
|
260
|
+
movementPattern?: MovementPattern | string;
|
|
261
|
+
forceDirection?: ForceDirection | string;
|
|
262
|
+
primaryMuscles: (MuscleGroup | string)[];
|
|
263
|
+
secondaryMuscles: (MuscleGroup | string)[];
|
|
264
|
+
equipment: (Equipment | string)[];
|
|
265
|
+
capabilities: ExerciseCapabilities;
|
|
266
|
+
createdBy?: UUID;
|
|
267
|
+
createdAt: DateTime;
|
|
268
|
+
updatedAt: DateTime;
|
|
269
|
+
}
|
|
270
|
+
interface CreateExerciseRequest {
|
|
271
|
+
name: string;
|
|
272
|
+
description?: string;
|
|
273
|
+
category: ExerciseCategory | string;
|
|
274
|
+
exerciseType?: string;
|
|
275
|
+
movementPattern?: MovementPattern | string;
|
|
276
|
+
forceDirection?: ForceDirection | string;
|
|
277
|
+
primaryMuscles: (MuscleGroup | string)[];
|
|
278
|
+
secondaryMuscles?: (MuscleGroup | string)[];
|
|
279
|
+
equipment: (Equipment | string)[];
|
|
280
|
+
capabilities: ExerciseCapabilities;
|
|
281
|
+
}
|
|
282
|
+
type UpdateExerciseRequest = Partial<CreateExerciseRequest>;
|
|
283
|
+
interface ListExercisesParams extends SearchParams {
|
|
284
|
+
category?: ExerciseCategory | string;
|
|
285
|
+
muscleGroup?: MuscleGroup | string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface SetData {
|
|
289
|
+
order: number;
|
|
290
|
+
reps?: number;
|
|
291
|
+
weight?: number;
|
|
292
|
+
restSeconds?: number;
|
|
293
|
+
distance?: number;
|
|
294
|
+
duration?: number;
|
|
295
|
+
tempo?: string;
|
|
296
|
+
rpe?: number;
|
|
297
|
+
notes?: string;
|
|
298
|
+
[key: string]: any;
|
|
299
|
+
}
|
|
300
|
+
interface WorkoutExercise {
|
|
301
|
+
id: UUID;
|
|
302
|
+
workoutId: UUID;
|
|
303
|
+
exerciseId: UUID;
|
|
304
|
+
orderIndex: number;
|
|
305
|
+
workoutFormat: WorkoutFormat | string;
|
|
306
|
+
setsData: SetData[];
|
|
307
|
+
isSuperset: boolean;
|
|
308
|
+
notes?: string;
|
|
309
|
+
exerciseName?: string;
|
|
310
|
+
exerciseDescription?: string;
|
|
311
|
+
}
|
|
312
|
+
interface Workout {
|
|
313
|
+
id: UUID;
|
|
314
|
+
name: string;
|
|
315
|
+
description?: string;
|
|
316
|
+
type: string;
|
|
317
|
+
createdBy: UUID;
|
|
318
|
+
createdAt: DateTime;
|
|
319
|
+
updatedAt: DateTime;
|
|
320
|
+
exercises?: WorkoutExercise[];
|
|
321
|
+
}
|
|
322
|
+
interface CreateWorkoutRequest {
|
|
323
|
+
name: string;
|
|
324
|
+
description?: string;
|
|
325
|
+
type: string;
|
|
326
|
+
}
|
|
327
|
+
type UpdateWorkoutRequest = Partial<CreateWorkoutRequest>;
|
|
328
|
+
interface AddExercisesToWorkoutRequest {
|
|
329
|
+
exercises: Array<{
|
|
330
|
+
exerciseId: UUID;
|
|
331
|
+
orderIndex: number;
|
|
332
|
+
workoutFormat: WorkoutFormat | string;
|
|
333
|
+
setsData: SetData[];
|
|
334
|
+
isSuperset?: boolean;
|
|
335
|
+
notes?: string;
|
|
336
|
+
}>;
|
|
337
|
+
}
|
|
338
|
+
interface UpdateWorkoutExerciseRequest {
|
|
339
|
+
orderIndex?: number;
|
|
340
|
+
workoutFormat?: WorkoutFormat | string;
|
|
341
|
+
setsData?: SetData[];
|
|
342
|
+
isSuperset?: boolean;
|
|
343
|
+
notes?: string;
|
|
344
|
+
}
|
|
345
|
+
interface ListWorkoutsParams extends ListParams {
|
|
346
|
+
search?: string;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
interface SessionExerciseDetail {
|
|
350
|
+
id: UUID;
|
|
351
|
+
sessionId: UUID;
|
|
352
|
+
exerciseId: UUID;
|
|
353
|
+
workoutExerciseId?: UUID;
|
|
354
|
+
orderPerformed: number;
|
|
355
|
+
startedAt?: DateTime;
|
|
356
|
+
completedAt?: DateTime;
|
|
357
|
+
workoutFormat: string;
|
|
358
|
+
setsData: SetData[];
|
|
359
|
+
totalSets: number;
|
|
360
|
+
completedSets: number;
|
|
361
|
+
totalVolume?: number;
|
|
362
|
+
totalDistance?: number;
|
|
363
|
+
totalDuration?: number;
|
|
364
|
+
skipped: boolean;
|
|
365
|
+
notes?: string;
|
|
366
|
+
formRating?: number;
|
|
367
|
+
rpe?: number;
|
|
368
|
+
exerciseName: string;
|
|
369
|
+
exerciseDescription?: string;
|
|
370
|
+
}
|
|
371
|
+
interface WorkoutSession {
|
|
372
|
+
id: UUID;
|
|
373
|
+
userId: UUID;
|
|
374
|
+
workoutId?: UUID;
|
|
375
|
+
name?: string;
|
|
376
|
+
programEnrollmentId?: UUID;
|
|
377
|
+
scheduledFor?: DateTime;
|
|
378
|
+
startedAt?: DateTime;
|
|
379
|
+
completedAt?: DateTime;
|
|
380
|
+
pausedDuration?: string;
|
|
381
|
+
status: SessionStatus;
|
|
382
|
+
userBodyweight?: number;
|
|
383
|
+
totalVolume?: number;
|
|
384
|
+
totalDistance?: number;
|
|
385
|
+
totalDuration?: number;
|
|
386
|
+
totalSetsCompleted: number;
|
|
387
|
+
totalExercisesCompleted: number;
|
|
388
|
+
notes?: string;
|
|
389
|
+
mood?: string;
|
|
390
|
+
location?: string;
|
|
391
|
+
createdAt: DateTime;
|
|
392
|
+
updatedAt: DateTime;
|
|
393
|
+
exercises?: SessionExerciseDetail[];
|
|
394
|
+
}
|
|
395
|
+
interface CreateWorkoutSessionRequest {
|
|
396
|
+
workoutId?: UUID;
|
|
397
|
+
name?: string;
|
|
398
|
+
status?: SessionStatus;
|
|
399
|
+
userBodyweight?: number;
|
|
400
|
+
scheduledFor?: DateTime;
|
|
401
|
+
notes?: string;
|
|
402
|
+
mood?: string;
|
|
403
|
+
location?: string;
|
|
404
|
+
}
|
|
405
|
+
interface AddExerciseItem {
|
|
406
|
+
exerciseId: UUID;
|
|
407
|
+
targetSets: number;
|
|
408
|
+
notes?: string;
|
|
409
|
+
}
|
|
410
|
+
interface UpdateExerciseItem {
|
|
411
|
+
id: UUID;
|
|
412
|
+
targetSets?: number;
|
|
413
|
+
notes?: string;
|
|
414
|
+
startedAt?: DateTime;
|
|
415
|
+
completedAt?: DateTime;
|
|
416
|
+
skipped?: boolean;
|
|
417
|
+
skipReason?: string;
|
|
418
|
+
}
|
|
419
|
+
interface UpdateWorkoutSessionRequest {
|
|
420
|
+
name?: string;
|
|
421
|
+
status?: SessionStatus;
|
|
422
|
+
startedAt?: DateTime;
|
|
423
|
+
completedAt?: DateTime;
|
|
424
|
+
notes?: string;
|
|
425
|
+
mood?: string;
|
|
426
|
+
location?: string;
|
|
427
|
+
completionPercentage?: number;
|
|
428
|
+
pausedDuration?: string;
|
|
429
|
+
userBodyweight?: number;
|
|
430
|
+
addExercises?: AddExerciseItem[];
|
|
431
|
+
updateExercises?: UpdateExerciseItem[];
|
|
432
|
+
removeExercises?: UUID[];
|
|
433
|
+
reorderExercises?: Record<UUID, number>;
|
|
434
|
+
updateSets?: Record<UUID, any[]>;
|
|
435
|
+
}
|
|
436
|
+
interface ListWorkoutSessionsParams extends ListParams, DateRangeParams {
|
|
437
|
+
status?: SessionStatus;
|
|
438
|
+
workoutId?: UUID;
|
|
439
|
+
includeExercises?: boolean;
|
|
440
|
+
}
|
|
441
|
+
interface ExerciseHistoryEntry {
|
|
442
|
+
date: DateString;
|
|
443
|
+
sessionId: UUID;
|
|
444
|
+
totalVolume?: number;
|
|
445
|
+
totalSets: number;
|
|
446
|
+
completedSets: number;
|
|
447
|
+
rpe?: number;
|
|
448
|
+
formRating?: number;
|
|
449
|
+
notes?: string;
|
|
450
|
+
}
|
|
451
|
+
interface ExerciseHistory {
|
|
452
|
+
exerciseId: UUID;
|
|
453
|
+
exerciseName: string;
|
|
454
|
+
history: ExerciseHistoryEntry[];
|
|
455
|
+
}
|
|
456
|
+
interface PersonalRecord {
|
|
457
|
+
exerciseId: UUID;
|
|
458
|
+
exerciseName: string;
|
|
459
|
+
recordType: RecordType;
|
|
460
|
+
value: number;
|
|
461
|
+
unit: string;
|
|
462
|
+
achievedDate: DateString;
|
|
463
|
+
sessionId: UUID;
|
|
464
|
+
}
|
|
465
|
+
interface PersonalRecordHistoryEntry {
|
|
466
|
+
value: number;
|
|
467
|
+
date: DateString;
|
|
468
|
+
sessionId: UUID;
|
|
469
|
+
}
|
|
470
|
+
interface PersonalRecordHistory {
|
|
471
|
+
exerciseId: UUID;
|
|
472
|
+
exerciseName: string;
|
|
473
|
+
recordType: RecordType;
|
|
474
|
+
unit: string;
|
|
475
|
+
history: PersonalRecordHistoryEntry[];
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
interface ProgramScheduleExercise {
|
|
479
|
+
exerciseId: UUID;
|
|
480
|
+
orderIndex: number;
|
|
481
|
+
sets: SetData[];
|
|
482
|
+
}
|
|
483
|
+
interface ProgramScheduleDay {
|
|
484
|
+
week: number;
|
|
485
|
+
day: number;
|
|
486
|
+
name: string;
|
|
487
|
+
exercises: ProgramScheduleExercise[];
|
|
488
|
+
}
|
|
489
|
+
interface ProgramMetadata {
|
|
490
|
+
difficulty?: string;
|
|
491
|
+
type?: string;
|
|
492
|
+
equipment?: string[];
|
|
493
|
+
duration?: string;
|
|
494
|
+
[key: string]: any;
|
|
495
|
+
}
|
|
496
|
+
interface Program {
|
|
497
|
+
id: UUID;
|
|
498
|
+
name: string;
|
|
499
|
+
description?: string;
|
|
500
|
+
createdBy: UUID;
|
|
501
|
+
isTemplate: boolean;
|
|
502
|
+
schedule: ProgramScheduleDay[];
|
|
503
|
+
metadata?: ProgramMetadata;
|
|
504
|
+
createdAt: DateTime;
|
|
505
|
+
updatedAt: DateTime;
|
|
506
|
+
}
|
|
507
|
+
interface CreateProgramRequest {
|
|
508
|
+
name: string;
|
|
509
|
+
description?: string;
|
|
510
|
+
schedule: ProgramScheduleDay[];
|
|
511
|
+
metadata?: ProgramMetadata;
|
|
512
|
+
}
|
|
513
|
+
type UpdateProgramRequest = Partial<CreateProgramRequest>;
|
|
514
|
+
interface EnrollInProgramRequest {
|
|
515
|
+
startDate: DateString;
|
|
516
|
+
}
|
|
517
|
+
interface ProgramEnrollment {
|
|
518
|
+
id: UUID;
|
|
519
|
+
userId: UUID;
|
|
520
|
+
programId: UUID;
|
|
521
|
+
startDate: DateString;
|
|
522
|
+
currentWeek: number;
|
|
523
|
+
currentDay: number;
|
|
524
|
+
status: 'active' | 'paused' | 'completed';
|
|
525
|
+
completedAt?: DateTime;
|
|
526
|
+
createdAt: DateTime;
|
|
527
|
+
updatedAt: DateTime;
|
|
528
|
+
}
|
|
529
|
+
interface UpdateEnrollmentRequest {
|
|
530
|
+
status?: 'active' | 'paused' | 'completed';
|
|
531
|
+
currentWeek?: number;
|
|
532
|
+
currentDay?: number;
|
|
533
|
+
}
|
|
534
|
+
interface EnrollmentProgress {
|
|
535
|
+
enrollmentId: UUID;
|
|
536
|
+
totalWeeks: number;
|
|
537
|
+
totalDays: number;
|
|
538
|
+
completedDays: number;
|
|
539
|
+
currentWeek: number;
|
|
540
|
+
currentDay: number;
|
|
541
|
+
completionPercentage: number;
|
|
542
|
+
}
|
|
543
|
+
interface CurrentWeekSchedule {
|
|
544
|
+
enrollmentId: UUID;
|
|
545
|
+
week: number;
|
|
546
|
+
days: ProgramScheduleDay[];
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
type MetricAggregationType = 'sum' | 'average' | 'min' | 'max' | 'latest';
|
|
550
|
+
type MetricCategory = 'body_composition' | 'cardiovascular' | 'strength' | 'flexibility' | 'sleep' | 'stress' | 'nutrition' | 'hydration' | 'custom';
|
|
551
|
+
interface Metric {
|
|
552
|
+
id: UUID;
|
|
553
|
+
key: string;
|
|
554
|
+
name: string;
|
|
555
|
+
description?: string;
|
|
556
|
+
category: MetricCategory | string;
|
|
557
|
+
unit: string;
|
|
558
|
+
aggregationType: MetricAggregationType;
|
|
559
|
+
createdAt: DateTime;
|
|
560
|
+
}
|
|
561
|
+
interface MetricEvent {
|
|
562
|
+
id: UUID;
|
|
563
|
+
userId: UUID;
|
|
564
|
+
metricId: UUID;
|
|
565
|
+
metricKey: string;
|
|
566
|
+
value: number;
|
|
567
|
+
metadata?: Record<string, any>;
|
|
568
|
+
loggedAt: DateTime;
|
|
569
|
+
source?: string;
|
|
570
|
+
referenceId?: UUID;
|
|
571
|
+
createdAt: DateTime;
|
|
572
|
+
}
|
|
573
|
+
interface CreateMetricEventRequest {
|
|
574
|
+
metricKey: string;
|
|
575
|
+
value: number;
|
|
576
|
+
metadata?: Record<string, any>;
|
|
577
|
+
loggedAt?: DateTime;
|
|
578
|
+
source?: string;
|
|
579
|
+
}
|
|
580
|
+
interface UpdateMetricEventRequest {
|
|
581
|
+
value?: number;
|
|
582
|
+
metadata?: Record<string, any>;
|
|
583
|
+
loggedAt?: DateTime;
|
|
584
|
+
}
|
|
585
|
+
interface BulkCreateMetricEventsRequest {
|
|
586
|
+
metrics: CreateMetricEventRequest[];
|
|
587
|
+
}
|
|
588
|
+
interface ListMetricEventsParams extends ListParams, DateRangeParams {
|
|
589
|
+
metricId?: UUID;
|
|
590
|
+
metricKey?: string;
|
|
591
|
+
}
|
|
592
|
+
interface DailyMetricAggregate {
|
|
593
|
+
date: DateString;
|
|
594
|
+
metricKey: string;
|
|
595
|
+
value: number;
|
|
596
|
+
count: number;
|
|
597
|
+
min?: number;
|
|
598
|
+
max?: number;
|
|
599
|
+
}
|
|
600
|
+
interface GetDailyMetricParams {
|
|
601
|
+
date?: DateString;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
interface UserGoal {
|
|
605
|
+
id: UUID;
|
|
606
|
+
userId: UUID;
|
|
607
|
+
metricId: UUID;
|
|
608
|
+
targetValue: number;
|
|
609
|
+
targetType: GoalTargetType;
|
|
610
|
+
effectiveFrom: DateString;
|
|
611
|
+
effectiveUntil?: DateString;
|
|
612
|
+
createdAt: DateTime;
|
|
613
|
+
metricKey?: string;
|
|
614
|
+
metricName?: string;
|
|
615
|
+
unit?: string;
|
|
616
|
+
}
|
|
617
|
+
interface CreateUserGoalRequest {
|
|
618
|
+
metricKey: string;
|
|
619
|
+
targetValue: number;
|
|
620
|
+
targetType: GoalTargetType;
|
|
621
|
+
effectiveFrom?: DateString;
|
|
622
|
+
effectiveUntil?: DateString;
|
|
623
|
+
}
|
|
624
|
+
interface UpdateUserGoalRequest {
|
|
625
|
+
targetValue?: number;
|
|
626
|
+
targetType?: GoalTargetType;
|
|
627
|
+
effectiveFrom?: DateString;
|
|
628
|
+
effectiveUntil?: DateString;
|
|
629
|
+
}
|
|
630
|
+
type GoalProgressStatus = 'on_track' | 'below' | 'above' | 'no_data';
|
|
631
|
+
interface GoalProgress {
|
|
632
|
+
id: UUID;
|
|
633
|
+
metricName: string;
|
|
634
|
+
targetValue: number;
|
|
635
|
+
targetType: GoalTargetType;
|
|
636
|
+
currentValue?: number;
|
|
637
|
+
status: GoalProgressStatus;
|
|
638
|
+
percentage?: number;
|
|
639
|
+
}
|
|
640
|
+
interface DailyGoalProgress {
|
|
641
|
+
date: DateString;
|
|
642
|
+
goals: GoalProgress[];
|
|
643
|
+
}
|
|
644
|
+
interface NutritionGoal {
|
|
645
|
+
type: NutritionGoalType;
|
|
646
|
+
value?: number;
|
|
647
|
+
min?: number;
|
|
648
|
+
max?: number;
|
|
649
|
+
}
|
|
650
|
+
interface UserNutritionGoals {
|
|
651
|
+
id: UUID;
|
|
652
|
+
userId: UUID;
|
|
653
|
+
effectiveDate: DateString;
|
|
654
|
+
goals: Record<string, NutritionGoal>;
|
|
655
|
+
caloriesTarget?: number;
|
|
656
|
+
proteinTarget?: number;
|
|
657
|
+
carbohydratesTarget?: number;
|
|
658
|
+
fatTarget?: number;
|
|
659
|
+
notes?: string;
|
|
660
|
+
createdAt: DateTime;
|
|
661
|
+
}
|
|
662
|
+
interface CreateNutritionGoalsRequest {
|
|
663
|
+
effectiveDate: DateString;
|
|
664
|
+
goals: Record<string, NutritionGoal>;
|
|
665
|
+
notes?: string;
|
|
666
|
+
}
|
|
667
|
+
type UpdateNutritionGoalsRequest = Partial<CreateNutritionGoalsRequest>;
|
|
668
|
+
interface BulkCreateNutritionGoalsRequest {
|
|
669
|
+
goals: Array<{
|
|
670
|
+
effectiveDate: DateString;
|
|
671
|
+
goals: Record<string, NutritionGoal>;
|
|
672
|
+
notes?: string;
|
|
673
|
+
}>;
|
|
674
|
+
}
|
|
675
|
+
interface CopyNutritionGoalsRequest {
|
|
676
|
+
fromDate: DateString;
|
|
677
|
+
toDate: DateString;
|
|
678
|
+
}
|
|
679
|
+
interface NutritionProgress {
|
|
680
|
+
nutrientKey: string;
|
|
681
|
+
goal: NutritionGoal;
|
|
682
|
+
current: number;
|
|
683
|
+
target?: number;
|
|
684
|
+
percentage: number;
|
|
685
|
+
status: GoalProgressStatus;
|
|
686
|
+
remaining?: number;
|
|
687
|
+
}
|
|
688
|
+
interface DailyNutritionProgress {
|
|
689
|
+
date: DateString;
|
|
690
|
+
effectiveGoalDate: DateString;
|
|
691
|
+
progress: NutritionProgress[];
|
|
692
|
+
summary: {
|
|
693
|
+
onTrack: number;
|
|
694
|
+
below: number;
|
|
695
|
+
over: number;
|
|
696
|
+
noData: number;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
interface ListNutritionGoalsHistoryParams extends ListParams, DateRangeParams {
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
type InsightType = 'nutrition_pattern' | 'workout_pattern' | 'performance_trend' | 'goal_progress' | 'recommendation';
|
|
703
|
+
type InsightSeverity = 'info' | 'warning' | 'success' | 'error';
|
|
704
|
+
interface Insight {
|
|
705
|
+
type: InsightType;
|
|
706
|
+
message: string;
|
|
707
|
+
severity: InsightSeverity;
|
|
708
|
+
metric?: string;
|
|
709
|
+
period?: string;
|
|
710
|
+
data?: Record<string, any>;
|
|
711
|
+
}
|
|
712
|
+
interface Recommendation {
|
|
713
|
+
category: string;
|
|
714
|
+
suggestion: string;
|
|
715
|
+
rationale?: string;
|
|
716
|
+
priority?: 'low' | 'medium' | 'high';
|
|
717
|
+
}
|
|
718
|
+
interface FoodInsightsResponse {
|
|
719
|
+
insights: Insight[];
|
|
720
|
+
recommendations: Recommendation[];
|
|
721
|
+
}
|
|
722
|
+
interface GetFoodInsightsParams extends DateRangeParams {
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
interface OpenLifeLogConfig {
|
|
726
|
+
apiKey?: string;
|
|
727
|
+
baseUrl?: string;
|
|
728
|
+
measurementSystem?: MeasurementSystem;
|
|
729
|
+
autoConvertUnits?: boolean;
|
|
730
|
+
timeout?: number;
|
|
731
|
+
maxRetries?: number;
|
|
732
|
+
enableRetries?: boolean;
|
|
733
|
+
headers?: Record<string, string>;
|
|
734
|
+
debug?: boolean;
|
|
735
|
+
fetch?: typeof fetch;
|
|
736
|
+
}
|
|
737
|
+
type ResolvedConfig = Required<Omit<OpenLifeLogConfig, 'apiKey'>> & {
|
|
738
|
+
apiKey?: string;
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
declare class WeightConverter {
|
|
742
|
+
static kgToLbs(kg: number): number;
|
|
743
|
+
static lbsToKg(lbs: number): number;
|
|
744
|
+
static fromMetric(kg: number, targetSystem: MeasurementSystem): number;
|
|
745
|
+
static toMetric(value: number, sourceSystem: MeasurementSystem): number;
|
|
746
|
+
}
|
|
747
|
+
declare class DistanceConverter {
|
|
748
|
+
static metersToMiles(meters: number): number;
|
|
749
|
+
static milesToMeters(miles: number): number;
|
|
750
|
+
static metersToFeet(meters: number): number;
|
|
751
|
+
static feetToMeters(feet: number): number;
|
|
752
|
+
static fromMetric(meters: number, targetSystem: MeasurementSystem, preferMiles?: boolean): number;
|
|
753
|
+
static toMetric(value: number, sourceSystem: MeasurementSystem, isMiles?: boolean): number;
|
|
754
|
+
}
|
|
755
|
+
declare class HeightConverter {
|
|
756
|
+
static cmToInches(cm: number): number;
|
|
757
|
+
static inchesToCm(inches: number): number;
|
|
758
|
+
static cmToFeetInches(cm: number): {
|
|
759
|
+
feet: number;
|
|
760
|
+
inches: number;
|
|
761
|
+
};
|
|
762
|
+
static feetInchesToCm(feet: number, inches: number): number;
|
|
763
|
+
static fromMetric(cm: number, targetSystem: MeasurementSystem): number;
|
|
764
|
+
static toMetric(value: number, sourceSystem: MeasurementSystem): number;
|
|
765
|
+
}
|
|
766
|
+
declare class UnitConverter {
|
|
767
|
+
private measurementSystem;
|
|
768
|
+
constructor(measurementSystem?: MeasurementSystem);
|
|
769
|
+
setMeasurementSystem(system: MeasurementSystem): void;
|
|
770
|
+
getMeasurementSystem(): MeasurementSystem;
|
|
771
|
+
weightFromMetric(kg: number | null | undefined): number | null;
|
|
772
|
+
weightToMetric(value: number | null | undefined): number | null;
|
|
773
|
+
distanceFromMetric(meters: number | null | undefined, preferMiles?: boolean): number | null;
|
|
774
|
+
distanceToMetric(value: number | null | undefined, isMiles?: boolean): number | null;
|
|
775
|
+
heightFromMetric(cm: number | null | undefined): number | null;
|
|
776
|
+
heightToMetric(value: number | null | undefined): number | null;
|
|
777
|
+
static round(value: number, decimals?: number): number;
|
|
778
|
+
getWeightUnit(): string;
|
|
779
|
+
getDistanceUnit(preferMiles?: boolean): string;
|
|
780
|
+
getHeightUnit(): string;
|
|
781
|
+
}
|
|
782
|
+
declare function createUnitConverter(measurementSystem?: MeasurementSystem): UnitConverter;
|
|
783
|
+
|
|
784
|
+
interface RequestOptions {
|
|
785
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
786
|
+
headers?: Record<string, string>;
|
|
787
|
+
body?: any;
|
|
788
|
+
params?: Record<string, any>;
|
|
789
|
+
timeout?: number;
|
|
790
|
+
skipRetry?: boolean;
|
|
791
|
+
}
|
|
792
|
+
interface HttpResponse<T = any> {
|
|
793
|
+
data: T;
|
|
794
|
+
status: number;
|
|
795
|
+
headers: Headers;
|
|
796
|
+
}
|
|
797
|
+
declare class HttpClient {
|
|
798
|
+
private config;
|
|
799
|
+
private baseUrl;
|
|
800
|
+
constructor(config: ResolvedConfig);
|
|
801
|
+
setApiKey(apiKey: string): void;
|
|
802
|
+
getApiKey(): string | undefined;
|
|
803
|
+
private toSnakeCase;
|
|
804
|
+
private buildUrl;
|
|
805
|
+
private buildHeaders;
|
|
806
|
+
private executeWithTimeout;
|
|
807
|
+
private sleep;
|
|
808
|
+
private isRetryableError;
|
|
809
|
+
private getRetryDelay;
|
|
810
|
+
request<T = any>(path: string, options?: RequestOptions): Promise<HttpResponse<T>>;
|
|
811
|
+
get<T = any>(path: string, params?: Record<string, any>, options?: Omit<RequestOptions, 'method' | 'body' | 'params'>): Promise<HttpResponse<T>>;
|
|
812
|
+
post<T = any>(path: string, body?: any, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<HttpResponse<T>>;
|
|
813
|
+
put<T = any>(path: string, body?: any, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<HttpResponse<T>>;
|
|
814
|
+
patch<T = any>(path: string, body?: any, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<HttpResponse<T>>;
|
|
815
|
+
delete<T = any>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<HttpResponse<T>>;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
declare class AuthResource {
|
|
819
|
+
private http;
|
|
820
|
+
constructor(http: HttpClient);
|
|
821
|
+
signup(request: SignupRequest): Promise<AuthResponse>;
|
|
822
|
+
login(request: LoginRequest): Promise<AuthResponse>;
|
|
823
|
+
requestPasswordReset(request: PasswordResetRequest): Promise<void>;
|
|
824
|
+
confirmPasswordReset(request: PasswordResetConfirm): Promise<void>;
|
|
825
|
+
logout(): void;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
declare class PaginatedIterator<T> {
|
|
829
|
+
private fetchPage;
|
|
830
|
+
private currentPage;
|
|
831
|
+
private currentIndex;
|
|
832
|
+
private nextCursor?;
|
|
833
|
+
private hasMore;
|
|
834
|
+
private isFirstFetch;
|
|
835
|
+
constructor(fetchPage: (cursor?: string) => Promise<ListResponse<T>>);
|
|
836
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
837
|
+
toArray(): Promise<T[]>;
|
|
838
|
+
}
|
|
839
|
+
declare function createPaginatedIterator<T>(fetchPage: (cursor?: string) => Promise<ListResponse<T>>): PaginatedIterator<T>;
|
|
840
|
+
declare function fetchAllPages<T>(fetchPage: (cursor?: string) => Promise<ListResponse<T>>, maxPages?: number): Promise<T[]>;
|
|
841
|
+
declare function hasMorePages(pageInfo: PageInfo): boolean;
|
|
842
|
+
|
|
843
|
+
declare class UsersResource {
|
|
844
|
+
private http;
|
|
845
|
+
constructor(http: HttpClient);
|
|
846
|
+
me(): Promise<User>;
|
|
847
|
+
update(request: UpdateUserRequest): Promise<User>;
|
|
848
|
+
getPreferences(): Promise<UserPreferences>;
|
|
849
|
+
updatePreferences(request: UpdatePreferencesRequest): Promise<UserPreferences>;
|
|
850
|
+
list(params?: ListParams): Promise<ListResponse<User>>;
|
|
851
|
+
search(params: {
|
|
852
|
+
q: string;
|
|
853
|
+
limit?: number;
|
|
854
|
+
cursor?: string;
|
|
855
|
+
}): Promise<ListResponse<User>>;
|
|
856
|
+
listAutoPaginate(params?: ListParams): PaginatedIterator<User>;
|
|
857
|
+
get(userId: string): Promise<User>;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
declare class FoodsResource {
|
|
861
|
+
private http;
|
|
862
|
+
constructor(http: HttpClient);
|
|
863
|
+
list(params?: ListFoodsParams): Promise<ListResponse<Food>>;
|
|
864
|
+
listAutoPaginate(params?: ListFoodsParams): PaginatedIterator<Food>;
|
|
865
|
+
count(): Promise<CountResponse>;
|
|
866
|
+
search(params: {
|
|
867
|
+
q: string;
|
|
868
|
+
limit?: number;
|
|
869
|
+
cursor?: string;
|
|
870
|
+
}): Promise<ListResponse<Food>>;
|
|
871
|
+
get(foodId: string): Promise<Food>;
|
|
872
|
+
create(request: CreateFoodRequest): Promise<Food>;
|
|
873
|
+
update(foodId: string, request: UpdateFoodRequest): Promise<Food>;
|
|
874
|
+
delete(foodId: string): Promise<void>;
|
|
875
|
+
getFavorites(params?: ListFoodsParams): Promise<ListResponse<Food>>;
|
|
876
|
+
addToFavorites(foodId: string): Promise<void>;
|
|
877
|
+
removeFromFavorites(foodId: string): Promise<void>;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
declare class FoodLogsResource {
|
|
881
|
+
private http;
|
|
882
|
+
constructor(http: HttpClient);
|
|
883
|
+
list(params?: ListFoodLogsParams): Promise<FoodLog[]>;
|
|
884
|
+
getDailySummary(params?: GetDailySummaryParams): Promise<DailyNutritionSummary>;
|
|
885
|
+
get(logId: string): Promise<FoodLog>;
|
|
886
|
+
create(request: CreateFoodLogRequest): Promise<FoodLog>;
|
|
887
|
+
quickEntry(request: QuickEntryFoodLogRequest): Promise<FoodLog>;
|
|
888
|
+
update(logId: string, request: UpdateFoodLogRequest): Promise<FoodLog>;
|
|
889
|
+
delete(logId: string): Promise<void>;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
declare class ExercisesResource {
|
|
893
|
+
private http;
|
|
894
|
+
constructor(http: HttpClient);
|
|
895
|
+
list(params?: ListExercisesParams): Promise<ListResponse<Exercise>>;
|
|
896
|
+
listAutoPaginate(params?: ListExercisesParams): PaginatedIterator<Exercise>;
|
|
897
|
+
count(): Promise<CountResponse>;
|
|
898
|
+
search(params: {
|
|
899
|
+
q: string;
|
|
900
|
+
limit?: number;
|
|
901
|
+
cursor?: string;
|
|
902
|
+
}): Promise<ListResponse<Exercise>>;
|
|
903
|
+
get(exerciseId: string): Promise<Exercise>;
|
|
904
|
+
create(request: CreateExerciseRequest): Promise<Exercise>;
|
|
905
|
+
update(exerciseId: string, request: UpdateExerciseRequest): Promise<Exercise>;
|
|
906
|
+
delete(exerciseId: string): Promise<void>;
|
|
907
|
+
getFavorites(params?: ListExercisesParams): Promise<ListResponse<Exercise>>;
|
|
908
|
+
addToFavorites(exerciseId: string): Promise<void>;
|
|
909
|
+
removeFromFavorites(exerciseId: string): Promise<void>;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
declare class WorkoutsResource {
|
|
913
|
+
private http;
|
|
914
|
+
constructor(http: HttpClient);
|
|
915
|
+
list(params?: ListWorkoutsParams): Promise<ListResponse<Workout>>;
|
|
916
|
+
listAutoPaginate(params?: ListWorkoutsParams): PaginatedIterator<Workout>;
|
|
917
|
+
count(): Promise<CountResponse>;
|
|
918
|
+
search(params: {
|
|
919
|
+
q: string;
|
|
920
|
+
limit?: number;
|
|
921
|
+
cursor?: string;
|
|
922
|
+
}): Promise<ListResponse<Workout>>;
|
|
923
|
+
get(workoutId: string): Promise<Workout>;
|
|
924
|
+
create(request: CreateWorkoutRequest): Promise<Workout>;
|
|
925
|
+
update(workoutId: string, request: UpdateWorkoutRequest): Promise<Workout>;
|
|
926
|
+
clone(workoutId: string): Promise<Workout>;
|
|
927
|
+
delete(workoutId: string): Promise<void>;
|
|
928
|
+
addExercises(workoutId: string, request: AddExercisesToWorkoutRequest): Promise<void>;
|
|
929
|
+
updateExercise(workoutId: string, exerciseId: string, request: UpdateWorkoutExerciseRequest): Promise<void>;
|
|
930
|
+
removeExercise(workoutId: string, exerciseId: string): Promise<void>;
|
|
931
|
+
getWorkoutsByExercise(exerciseId: string): Promise<ListResponse<Workout>>;
|
|
932
|
+
getFavorites(params?: ListWorkoutsParams): Promise<ListResponse<Workout>>;
|
|
933
|
+
addToFavorites(workoutId: string): Promise<void>;
|
|
934
|
+
removeFromFavorites(workoutId: string): Promise<void>;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
declare class SessionsResource {
|
|
938
|
+
private http;
|
|
939
|
+
constructor(http: HttpClient);
|
|
940
|
+
list(params?: ListWorkoutSessionsParams): Promise<ListResponse<WorkoutSession>>;
|
|
941
|
+
listAutoPaginate(params?: ListWorkoutSessionsParams): PaginatedIterator<WorkoutSession>;
|
|
942
|
+
create(request: CreateWorkoutSessionRequest): Promise<WorkoutSession>;
|
|
943
|
+
start(request: Omit<CreateWorkoutSessionRequest, 'status'>): Promise<WorkoutSession>;
|
|
944
|
+
get(sessionId: string): Promise<WorkoutSession>;
|
|
945
|
+
update(sessionId: string, request: UpdateWorkoutSessionRequest): Promise<WorkoutSession>;
|
|
946
|
+
complete(sessionId: string, notes?: string): Promise<WorkoutSession>;
|
|
947
|
+
addExercises(sessionId: string, exercises: AddExerciseItem[]): Promise<WorkoutSession>;
|
|
948
|
+
delete(sessionId: string): Promise<void>;
|
|
949
|
+
getSessionsByWorkout(workoutId: string, params?: ListWorkoutSessionsParams): Promise<ListResponse<WorkoutSession>>;
|
|
950
|
+
getExerciseHistory(exerciseId: string): Promise<ExerciseHistory>;
|
|
951
|
+
getPersonalRecords(): Promise<ListResponse<PersonalRecord>>;
|
|
952
|
+
getExercisePersonalRecords(exerciseId: string): Promise<ListResponse<PersonalRecord>>;
|
|
953
|
+
getPersonalRecordHistory(exerciseId: string): Promise<ListResponse<PersonalRecordHistory>>;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
declare class ProgramsResource {
|
|
957
|
+
private http;
|
|
958
|
+
constructor(http: HttpClient);
|
|
959
|
+
list(params?: ListParams): Promise<ListResponse<Program>>;
|
|
960
|
+
listTemplates(params?: ListParams): Promise<ListResponse<Program>>;
|
|
961
|
+
create(request: CreateProgramRequest): Promise<Program>;
|
|
962
|
+
get(programId: string): Promise<Program>;
|
|
963
|
+
update(programId: string, request: UpdateProgramRequest): Promise<Program>;
|
|
964
|
+
delete(programId: string): Promise<void>;
|
|
965
|
+
enroll(programId: string, request: EnrollInProgramRequest): Promise<ProgramEnrollment>;
|
|
966
|
+
listEnrollments(params?: ListParams): Promise<ListResponse<ProgramEnrollment>>;
|
|
967
|
+
getEnrollment(enrollmentId: string): Promise<ProgramEnrollment>;
|
|
968
|
+
updateEnrollment(enrollmentId: string, request: UpdateEnrollmentRequest): Promise<ProgramEnrollment>;
|
|
969
|
+
unenroll(enrollmentId: string): Promise<void>;
|
|
970
|
+
getEnrollmentProgress(enrollmentId: string): Promise<EnrollmentProgress>;
|
|
971
|
+
getCurrentWeek(enrollmentId: string): Promise<CurrentWeekSchedule>;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
declare class MetricsResource {
|
|
975
|
+
private http;
|
|
976
|
+
constructor(http: HttpClient);
|
|
977
|
+
list(): Promise<ListResponse<Metric>>;
|
|
978
|
+
get(metricId: string): Promise<Metric>;
|
|
979
|
+
getByCategory(category: string): Promise<ListResponse<Metric>>;
|
|
980
|
+
getDailyMetric(metricKey: string, params?: GetDailyMetricParams): Promise<DailyMetricAggregate>;
|
|
981
|
+
listEvents(params?: ListMetricEventsParams): Promise<ListResponse<MetricEvent>>;
|
|
982
|
+
listEventsAutoPaginate(params?: ListMetricEventsParams): PaginatedIterator<MetricEvent>;
|
|
983
|
+
getEvent(eventId: string): Promise<MetricEvent>;
|
|
984
|
+
log(request: CreateMetricEventRequest): Promise<MetricEvent>;
|
|
985
|
+
createEvent(request: CreateMetricEventRequest): Promise<MetricEvent>;
|
|
986
|
+
bulkCreateEvents(request: BulkCreateMetricEventsRequest): Promise<void>;
|
|
987
|
+
updateEvent(eventId: string, request: UpdateMetricEventRequest): Promise<MetricEvent>;
|
|
988
|
+
deleteEvent(eventId: string): Promise<void>;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
declare class GoalsResource {
|
|
992
|
+
private http;
|
|
993
|
+
constructor(http: HttpClient);
|
|
994
|
+
list(): Promise<ListResponse<UserGoal>>;
|
|
995
|
+
getByDate(date: string): Promise<ListResponse<UserGoal>>;
|
|
996
|
+
create(request: CreateUserGoalRequest): Promise<UserGoal>;
|
|
997
|
+
update(goalId: string, request: UpdateUserGoalRequest): Promise<UserGoal>;
|
|
998
|
+
delete(goalId: string): Promise<void>;
|
|
999
|
+
getProgress(): Promise<DailyGoalProgress>;
|
|
1000
|
+
getProgressByDate(date: string): Promise<DailyGoalProgress>;
|
|
1001
|
+
getNutritionGoals(): Promise<UserNutritionGoals>;
|
|
1002
|
+
getNutritionGoalsByDate(date: string): Promise<UserNutritionGoals>;
|
|
1003
|
+
createNutritionGoals(request: CreateNutritionGoalsRequest): Promise<UserNutritionGoals>;
|
|
1004
|
+
updateNutritionGoals(date: string, request: UpdateNutritionGoalsRequest): Promise<UserNutritionGoals>;
|
|
1005
|
+
deleteNutritionGoals(date: string): Promise<void>;
|
|
1006
|
+
bulkCreateNutritionGoals(request: BulkCreateNutritionGoalsRequest): Promise<void>;
|
|
1007
|
+
copyNutritionGoals(request: CopyNutritionGoalsRequest): Promise<void>;
|
|
1008
|
+
getNutritionGoalsHistory(params?: ListNutritionGoalsHistoryParams): Promise<ListResponse<UserNutritionGoals>>;
|
|
1009
|
+
getNutritionProgress(): Promise<DailyNutritionProgress>;
|
|
1010
|
+
getNutritionProgressByDate(date: string): Promise<DailyNutritionProgress>;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
declare class AIResource {
|
|
1014
|
+
private http;
|
|
1015
|
+
constructor(http: HttpClient);
|
|
1016
|
+
getFoodInsights(params?: GetFoodInsightsParams): Promise<FoodInsightsResponse>;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
declare class OpenLifeLog {
|
|
1020
|
+
private config;
|
|
1021
|
+
private httpClient;
|
|
1022
|
+
private unitConverter;
|
|
1023
|
+
readonly auth: AuthResource;
|
|
1024
|
+
readonly users: UsersResource;
|
|
1025
|
+
readonly foods: FoodsResource;
|
|
1026
|
+
readonly foodLogs: FoodLogsResource;
|
|
1027
|
+
readonly exercises: ExercisesResource;
|
|
1028
|
+
readonly workouts: WorkoutsResource;
|
|
1029
|
+
readonly sessions: SessionsResource;
|
|
1030
|
+
readonly programs: ProgramsResource;
|
|
1031
|
+
readonly metrics: MetricsResource;
|
|
1032
|
+
readonly goals: GoalsResource;
|
|
1033
|
+
readonly ai: AIResource;
|
|
1034
|
+
constructor(config?: OpenLifeLogConfig);
|
|
1035
|
+
setApiKey(apiKey: string): void;
|
|
1036
|
+
getApiKey(): string | undefined;
|
|
1037
|
+
getUnitConverter(): UnitConverter;
|
|
1038
|
+
setMeasurementSystem(system: 'metric' | 'imperial'): void;
|
|
1039
|
+
getMeasurementSystem(): 'metric' | 'imperial';
|
|
1040
|
+
logFood(request: CreateFoodLogRequest): Promise<FoodLog>;
|
|
1041
|
+
getTodayNutrition(): Promise<DailyNutritionSummary>;
|
|
1042
|
+
getTodayProgress(): Promise<DailyGoalProgress>;
|
|
1043
|
+
getTodayNutritionProgress(): Promise<DailyNutritionProgress>;
|
|
1044
|
+
isAuthenticated(): boolean;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
interface MetricDefinition {
|
|
1048
|
+
key: string;
|
|
1049
|
+
displayName: string;
|
|
1050
|
+
category: 'body' | 'activity' | 'sleep' | 'vital' | 'wellness';
|
|
1051
|
+
unit: string;
|
|
1052
|
+
aggregation: 'last' | 'sum' | 'avg' | 'min' | 'max';
|
|
1053
|
+
imperialUnit?: string;
|
|
1054
|
+
imperialConversion?: number;
|
|
1055
|
+
}
|
|
1056
|
+
declare const BODY_METRICS: MetricDefinition[];
|
|
1057
|
+
declare const ACTIVITY_METRICS: MetricDefinition[];
|
|
1058
|
+
declare const SLEEP_METRICS: MetricDefinition[];
|
|
1059
|
+
declare const VITAL_METRICS: MetricDefinition[];
|
|
1060
|
+
declare const WELLNESS_METRICS: MetricDefinition[];
|
|
1061
|
+
declare const ALL_METRICS: MetricDefinition[];
|
|
1062
|
+
declare function getMetricDefinition(key: string): MetricDefinition | undefined;
|
|
1063
|
+
declare function getMetricsByCategory(category: MetricDefinition['category']): MetricDefinition[];
|
|
1064
|
+
|
|
1065
|
+
declare class OpenLifeLogError extends Error {
|
|
1066
|
+
readonly statusCode?: number;
|
|
1067
|
+
readonly code?: string;
|
|
1068
|
+
readonly rawError?: any;
|
|
1069
|
+
constructor(message: string, statusCode?: number, code?: string, rawError?: any);
|
|
1070
|
+
}
|
|
1071
|
+
declare class AuthenticationError extends OpenLifeLogError {
|
|
1072
|
+
constructor(message?: string, rawError?: any);
|
|
1073
|
+
}
|
|
1074
|
+
declare class AuthorizationError extends OpenLifeLogError {
|
|
1075
|
+
constructor(message?: string, rawError?: any);
|
|
1076
|
+
}
|
|
1077
|
+
declare class NotFoundError extends OpenLifeLogError {
|
|
1078
|
+
constructor(message?: string, rawError?: any);
|
|
1079
|
+
}
|
|
1080
|
+
declare class ValidationError extends OpenLifeLogError {
|
|
1081
|
+
readonly validationErrors?: Record<string, string[]>;
|
|
1082
|
+
constructor(message?: string, validationErrors?: Record<string, string[]>, rawError?: any);
|
|
1083
|
+
}
|
|
1084
|
+
declare class RateLimitError extends OpenLifeLogError {
|
|
1085
|
+
readonly retryAfter?: number;
|
|
1086
|
+
constructor(message?: string, retryAfter?: number, rawError?: any);
|
|
1087
|
+
}
|
|
1088
|
+
declare class ServerError extends OpenLifeLogError {
|
|
1089
|
+
constructor(message?: string, rawError?: any);
|
|
1090
|
+
}
|
|
1091
|
+
declare class NetworkError extends OpenLifeLogError {
|
|
1092
|
+
constructor(message?: string, rawError?: any);
|
|
1093
|
+
}
|
|
1094
|
+
declare class TimeoutError extends OpenLifeLogError {
|
|
1095
|
+
constructor(message?: string, rawError?: any);
|
|
1096
|
+
}
|
|
1097
|
+
declare class UnitConversionError extends OpenLifeLogError {
|
|
1098
|
+
constructor(message?: string, rawError?: any);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
export { ACTIVITY_METRICS, ALL_METRICS, type AddExerciseItem, type AddExercisesToWorkoutRequest, type AuthResponse, AuthenticationError, AuthorizationError, BODY_METRICS, type BulkCreateMetricEventsRequest, type BulkCreateNutritionGoalsRequest, type CopyNutritionGoalsRequest, type CountResponse, type CreateExerciseRequest, type CreateFoodLogRequest, type CreateFoodRequest, type CreateMetricEventRequest, type CreateNutritionGoalsRequest, type CreateProgramRequest, type CreateUserGoalRequest, type CreateWorkoutRequest, type CreateWorkoutSessionRequest, type CurrentWeekSchedule, type DailyGoalProgress, type DailyMetricAggregate, type DailyNutritionProgress, type DailyNutritionSummary, type DateRangeParams, type DateString, type DateTime, DistanceConverter, type EnrollInProgramRequest, type EnrollmentProgress, type Equipment, type ErrorResponse, type Exercise, type ExerciseCapabilities, type ExerciseCategory, type ExerciseHistory, type ExerciseHistoryEntry, type Food, type FoodInsightsResponse, type FoodLog, type ForceDirection, type GetDailyMetricParams, type GetDailySummaryParams, type GetFoodInsightsParams, type GoalProgress, type GoalProgressStatus, type GoalTargetType, HeightConverter, type Insight, type InsightSeverity, type InsightType, type ListExercisesParams, type ListFoodLogsParams, type ListFoodsParams, type ListMetricEventsParams, type ListNutritionGoalsHistoryParams, type ListParams, type ListResponse, type ListWorkoutSessionsParams, type ListWorkoutsParams, type LoginRequest, type MealType, type MeasurementSystem, type Metric, type MetricAggregationType, type MetricCategory, type MetricDefinition, type MetricEvent, type MovementPattern, type MuscleGroup, NetworkError, NotFoundError, type NutritionGoal, type NutritionGoalType, type NutritionProgress, type NutritionalInformation, OpenLifeLog, type OpenLifeLogConfig, OpenLifeLogError, type PageInfo, PaginatedIterator, type PasswordResetConfirm, type PasswordResetRequest, type PersonalRecord, type PersonalRecordHistory, type PersonalRecordHistoryEntry, type Program, type ProgramEnrollment, type ProgramMetadata, type ProgramScheduleDay, type ProgramScheduleExercise, type QuickEntryFoodLogRequest, RateLimitError, type Recommendation, type RecordType, SLEEP_METRICS, type SearchParams, ServerError, type ServingSize, type SessionExerciseDetail, type SessionStatus, type SetData, type SignupRequest, type SuccessResponse, TimeoutError, type UUID, UnitConversionError, UnitConverter, type UpdateEnrollmentRequest, type UpdateExerciseItem, type UpdateExerciseRequest, type UpdateFoodLogRequest, type UpdateFoodRequest, type UpdateMetricEventRequest, type UpdateNutritionGoalsRequest, type UpdatePreferencesRequest, type UpdateProgramRequest, type UpdateUserGoalRequest, type UpdateUserRequest, type UpdateWorkoutExerciseRequest, type UpdateWorkoutRequest, type UpdateWorkoutSessionRequest, type User, type UserGoal, type UserNutritionGoals, type UserPreferences, VITAL_METRICS, ValidationError, WELLNESS_METRICS, WeightConverter, type Workout, type WorkoutExercise, type WorkoutFormat, type WorkoutSession, createPaginatedIterator, createUnitConverter, OpenLifeLog as default, fetchAllPages, getMetricDefinition, getMetricsByCategory, hasMorePages };
|