@openlifelog/sdk 1.0.1 → 1.0.3
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/client.ts +6 -6
- package/dist/index.d.mts +13 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +390 -20
- package/dist/index.mjs +390 -20
- package/package.json +1 -1
- package/resources/goals.ts +39 -4
- package/resources/metrics.ts +87 -4
- package/resources/programs.ts +44 -4
- package/resources/sessions.ts +59 -4
- package/resources/workouts.ts +54 -4
- package/types/exercise.ts +1 -1
- package/types/food.ts +2 -0
- package/utils/units.ts +357 -0
package/client.ts
CHANGED
|
@@ -62,17 +62,17 @@ export class OpenLifeLog {
|
|
|
62
62
|
this.httpClient = new HttpClient(this.config);
|
|
63
63
|
this.unitConverter = createUnitConverter(this.config.measurementSystem);
|
|
64
64
|
|
|
65
|
-
// Initialize all resources
|
|
65
|
+
// Initialize all resources (pass config for unit conversion)
|
|
66
66
|
this.auth = new AuthResource(this.httpClient);
|
|
67
67
|
this.users = new UsersResource(this.httpClient);
|
|
68
68
|
this.foods = new FoodsResource(this.httpClient);
|
|
69
69
|
this.foodLogs = new FoodLogsResource(this.httpClient);
|
|
70
70
|
this.exercises = new ExercisesResource(this.httpClient);
|
|
71
|
-
this.workouts = new WorkoutsResource(this.httpClient);
|
|
72
|
-
this.sessions = new SessionsResource(this.httpClient);
|
|
73
|
-
this.programs = new ProgramsResource(this.httpClient);
|
|
74
|
-
this.metrics = new MetricsResource(this.httpClient);
|
|
75
|
-
this.goals = new GoalsResource(this.httpClient);
|
|
71
|
+
this.workouts = new WorkoutsResource(this.httpClient, this.config);
|
|
72
|
+
this.sessions = new SessionsResource(this.httpClient, this.config);
|
|
73
|
+
this.programs = new ProgramsResource(this.httpClient, this.config);
|
|
74
|
+
this.metrics = new MetricsResource(this.httpClient, this.config);
|
|
75
|
+
this.goals = new GoalsResource(this.httpClient, this.config);
|
|
76
76
|
this.ai = new AIResource(this.httpClient);
|
|
77
77
|
}
|
|
78
78
|
|
package/dist/index.d.mts
CHANGED
|
@@ -150,6 +150,7 @@ interface NutritionalInformation {
|
|
|
150
150
|
interface ServingSize {
|
|
151
151
|
name: string;
|
|
152
152
|
grams: number;
|
|
153
|
+
ml?: number;
|
|
153
154
|
isDefault: boolean;
|
|
154
155
|
}
|
|
155
156
|
interface Food {
|
|
@@ -203,6 +204,7 @@ interface FoodLog {
|
|
|
203
204
|
createdAt: DateTime;
|
|
204
205
|
foodName?: string;
|
|
205
206
|
foodBrand?: string;
|
|
207
|
+
foodType?: 'food' | 'beverage' | 'meal';
|
|
206
208
|
}
|
|
207
209
|
interface CreateFoodLogRequest {
|
|
208
210
|
foodId: UUID;
|
|
@@ -247,7 +249,7 @@ interface QuickEntryFoodLogRequest {
|
|
|
247
249
|
|
|
248
250
|
interface ExerciseCapabilities {
|
|
249
251
|
supportsWeight: boolean;
|
|
250
|
-
|
|
252
|
+
isBodyweight: boolean;
|
|
251
253
|
supportsAssistance: boolean;
|
|
252
254
|
supportsDistance: boolean;
|
|
253
255
|
supportsDuration: boolean;
|
|
@@ -913,7 +915,8 @@ declare class ExercisesResource {
|
|
|
913
915
|
|
|
914
916
|
declare class WorkoutsResource {
|
|
915
917
|
private http;
|
|
916
|
-
|
|
918
|
+
private config;
|
|
919
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
917
920
|
list(params?: ListWorkoutsParams): Promise<ListResponse<Workout>>;
|
|
918
921
|
listAutoPaginate(params?: ListWorkoutsParams): PaginatedIterator<Workout>;
|
|
919
922
|
count(): Promise<CountResponse>;
|
|
@@ -938,7 +941,8 @@ declare class WorkoutsResource {
|
|
|
938
941
|
|
|
939
942
|
declare class SessionsResource {
|
|
940
943
|
private http;
|
|
941
|
-
|
|
944
|
+
private config;
|
|
945
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
942
946
|
list(params?: ListWorkoutSessionsParams): Promise<ListResponse<WorkoutSession>>;
|
|
943
947
|
listAutoPaginate(params?: ListWorkoutSessionsParams): PaginatedIterator<WorkoutSession>;
|
|
944
948
|
create(request: CreateWorkoutSessionRequest): Promise<WorkoutSession>;
|
|
@@ -957,7 +961,8 @@ declare class SessionsResource {
|
|
|
957
961
|
|
|
958
962
|
declare class ProgramsResource {
|
|
959
963
|
private http;
|
|
960
|
-
|
|
964
|
+
private config;
|
|
965
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
961
966
|
list(params?: ListParams): Promise<ListResponse<Program>>;
|
|
962
967
|
listTemplates(params?: ListParams): Promise<ListResponse<Program>>;
|
|
963
968
|
create(request: CreateProgramRequest): Promise<Program>;
|
|
@@ -975,7 +980,8 @@ declare class ProgramsResource {
|
|
|
975
980
|
|
|
976
981
|
declare class MetricsResource {
|
|
977
982
|
private http;
|
|
978
|
-
|
|
983
|
+
private config;
|
|
984
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
979
985
|
list(): Promise<ListResponse<Metric>>;
|
|
980
986
|
get(metricId: string): Promise<Metric>;
|
|
981
987
|
getByCategory(category: string): Promise<ListResponse<Metric>>;
|
|
@@ -992,7 +998,8 @@ declare class MetricsResource {
|
|
|
992
998
|
|
|
993
999
|
declare class GoalsResource {
|
|
994
1000
|
private http;
|
|
995
|
-
|
|
1001
|
+
private config;
|
|
1002
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
996
1003
|
list(): Promise<ListResponse<UserGoal>>;
|
|
997
1004
|
getByDate(date: string): Promise<ListResponse<UserGoal>>;
|
|
998
1005
|
create(request: CreateUserGoalRequest): Promise<UserGoal>;
|
package/dist/index.d.ts
CHANGED
|
@@ -150,6 +150,7 @@ interface NutritionalInformation {
|
|
|
150
150
|
interface ServingSize {
|
|
151
151
|
name: string;
|
|
152
152
|
grams: number;
|
|
153
|
+
ml?: number;
|
|
153
154
|
isDefault: boolean;
|
|
154
155
|
}
|
|
155
156
|
interface Food {
|
|
@@ -203,6 +204,7 @@ interface FoodLog {
|
|
|
203
204
|
createdAt: DateTime;
|
|
204
205
|
foodName?: string;
|
|
205
206
|
foodBrand?: string;
|
|
207
|
+
foodType?: 'food' | 'beverage' | 'meal';
|
|
206
208
|
}
|
|
207
209
|
interface CreateFoodLogRequest {
|
|
208
210
|
foodId: UUID;
|
|
@@ -247,7 +249,7 @@ interface QuickEntryFoodLogRequest {
|
|
|
247
249
|
|
|
248
250
|
interface ExerciseCapabilities {
|
|
249
251
|
supportsWeight: boolean;
|
|
250
|
-
|
|
252
|
+
isBodyweight: boolean;
|
|
251
253
|
supportsAssistance: boolean;
|
|
252
254
|
supportsDistance: boolean;
|
|
253
255
|
supportsDuration: boolean;
|
|
@@ -913,7 +915,8 @@ declare class ExercisesResource {
|
|
|
913
915
|
|
|
914
916
|
declare class WorkoutsResource {
|
|
915
917
|
private http;
|
|
916
|
-
|
|
918
|
+
private config;
|
|
919
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
917
920
|
list(params?: ListWorkoutsParams): Promise<ListResponse<Workout>>;
|
|
918
921
|
listAutoPaginate(params?: ListWorkoutsParams): PaginatedIterator<Workout>;
|
|
919
922
|
count(): Promise<CountResponse>;
|
|
@@ -938,7 +941,8 @@ declare class WorkoutsResource {
|
|
|
938
941
|
|
|
939
942
|
declare class SessionsResource {
|
|
940
943
|
private http;
|
|
941
|
-
|
|
944
|
+
private config;
|
|
945
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
942
946
|
list(params?: ListWorkoutSessionsParams): Promise<ListResponse<WorkoutSession>>;
|
|
943
947
|
listAutoPaginate(params?: ListWorkoutSessionsParams): PaginatedIterator<WorkoutSession>;
|
|
944
948
|
create(request: CreateWorkoutSessionRequest): Promise<WorkoutSession>;
|
|
@@ -957,7 +961,8 @@ declare class SessionsResource {
|
|
|
957
961
|
|
|
958
962
|
declare class ProgramsResource {
|
|
959
963
|
private http;
|
|
960
|
-
|
|
964
|
+
private config;
|
|
965
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
961
966
|
list(params?: ListParams): Promise<ListResponse<Program>>;
|
|
962
967
|
listTemplates(params?: ListParams): Promise<ListResponse<Program>>;
|
|
963
968
|
create(request: CreateProgramRequest): Promise<Program>;
|
|
@@ -975,7 +980,8 @@ declare class ProgramsResource {
|
|
|
975
980
|
|
|
976
981
|
declare class MetricsResource {
|
|
977
982
|
private http;
|
|
978
|
-
|
|
983
|
+
private config;
|
|
984
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
979
985
|
list(): Promise<ListResponse<Metric>>;
|
|
980
986
|
get(metricId: string): Promise<Metric>;
|
|
981
987
|
getByCategory(category: string): Promise<ListResponse<Metric>>;
|
|
@@ -992,7 +998,8 @@ declare class MetricsResource {
|
|
|
992
998
|
|
|
993
999
|
declare class GoalsResource {
|
|
994
1000
|
private http;
|
|
995
|
-
|
|
1001
|
+
private config;
|
|
1002
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
996
1003
|
list(): Promise<ListResponse<UserGoal>>;
|
|
997
1004
|
getByDate(date: string): Promise<ListResponse<UserGoal>>;
|
|
998
1005
|
create(request: CreateUserGoalRequest): Promise<UserGoal>;
|