@openlifelog/sdk 1.0.2 → 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 +11 -6
- package/dist/index.d.ts +11 -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/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
|
@@ -249,7 +249,7 @@ interface QuickEntryFoodLogRequest {
|
|
|
249
249
|
|
|
250
250
|
interface ExerciseCapabilities {
|
|
251
251
|
supportsWeight: boolean;
|
|
252
|
-
|
|
252
|
+
isBodyweight: boolean;
|
|
253
253
|
supportsAssistance: boolean;
|
|
254
254
|
supportsDistance: boolean;
|
|
255
255
|
supportsDuration: boolean;
|
|
@@ -915,7 +915,8 @@ declare class ExercisesResource {
|
|
|
915
915
|
|
|
916
916
|
declare class WorkoutsResource {
|
|
917
917
|
private http;
|
|
918
|
-
|
|
918
|
+
private config;
|
|
919
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
919
920
|
list(params?: ListWorkoutsParams): Promise<ListResponse<Workout>>;
|
|
920
921
|
listAutoPaginate(params?: ListWorkoutsParams): PaginatedIterator<Workout>;
|
|
921
922
|
count(): Promise<CountResponse>;
|
|
@@ -940,7 +941,8 @@ declare class WorkoutsResource {
|
|
|
940
941
|
|
|
941
942
|
declare class SessionsResource {
|
|
942
943
|
private http;
|
|
943
|
-
|
|
944
|
+
private config;
|
|
945
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
944
946
|
list(params?: ListWorkoutSessionsParams): Promise<ListResponse<WorkoutSession>>;
|
|
945
947
|
listAutoPaginate(params?: ListWorkoutSessionsParams): PaginatedIterator<WorkoutSession>;
|
|
946
948
|
create(request: CreateWorkoutSessionRequest): Promise<WorkoutSession>;
|
|
@@ -959,7 +961,8 @@ declare class SessionsResource {
|
|
|
959
961
|
|
|
960
962
|
declare class ProgramsResource {
|
|
961
963
|
private http;
|
|
962
|
-
|
|
964
|
+
private config;
|
|
965
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
963
966
|
list(params?: ListParams): Promise<ListResponse<Program>>;
|
|
964
967
|
listTemplates(params?: ListParams): Promise<ListResponse<Program>>;
|
|
965
968
|
create(request: CreateProgramRequest): Promise<Program>;
|
|
@@ -977,7 +980,8 @@ declare class ProgramsResource {
|
|
|
977
980
|
|
|
978
981
|
declare class MetricsResource {
|
|
979
982
|
private http;
|
|
980
|
-
|
|
983
|
+
private config;
|
|
984
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
981
985
|
list(): Promise<ListResponse<Metric>>;
|
|
982
986
|
get(metricId: string): Promise<Metric>;
|
|
983
987
|
getByCategory(category: string): Promise<ListResponse<Metric>>;
|
|
@@ -994,7 +998,8 @@ declare class MetricsResource {
|
|
|
994
998
|
|
|
995
999
|
declare class GoalsResource {
|
|
996
1000
|
private http;
|
|
997
|
-
|
|
1001
|
+
private config;
|
|
1002
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
998
1003
|
list(): Promise<ListResponse<UserGoal>>;
|
|
999
1004
|
getByDate(date: string): Promise<ListResponse<UserGoal>>;
|
|
1000
1005
|
create(request: CreateUserGoalRequest): Promise<UserGoal>;
|
package/dist/index.d.ts
CHANGED
|
@@ -249,7 +249,7 @@ interface QuickEntryFoodLogRequest {
|
|
|
249
249
|
|
|
250
250
|
interface ExerciseCapabilities {
|
|
251
251
|
supportsWeight: boolean;
|
|
252
|
-
|
|
252
|
+
isBodyweight: boolean;
|
|
253
253
|
supportsAssistance: boolean;
|
|
254
254
|
supportsDistance: boolean;
|
|
255
255
|
supportsDuration: boolean;
|
|
@@ -915,7 +915,8 @@ declare class ExercisesResource {
|
|
|
915
915
|
|
|
916
916
|
declare class WorkoutsResource {
|
|
917
917
|
private http;
|
|
918
|
-
|
|
918
|
+
private config;
|
|
919
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
919
920
|
list(params?: ListWorkoutsParams): Promise<ListResponse<Workout>>;
|
|
920
921
|
listAutoPaginate(params?: ListWorkoutsParams): PaginatedIterator<Workout>;
|
|
921
922
|
count(): Promise<CountResponse>;
|
|
@@ -940,7 +941,8 @@ declare class WorkoutsResource {
|
|
|
940
941
|
|
|
941
942
|
declare class SessionsResource {
|
|
942
943
|
private http;
|
|
943
|
-
|
|
944
|
+
private config;
|
|
945
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
944
946
|
list(params?: ListWorkoutSessionsParams): Promise<ListResponse<WorkoutSession>>;
|
|
945
947
|
listAutoPaginate(params?: ListWorkoutSessionsParams): PaginatedIterator<WorkoutSession>;
|
|
946
948
|
create(request: CreateWorkoutSessionRequest): Promise<WorkoutSession>;
|
|
@@ -959,7 +961,8 @@ declare class SessionsResource {
|
|
|
959
961
|
|
|
960
962
|
declare class ProgramsResource {
|
|
961
963
|
private http;
|
|
962
|
-
|
|
964
|
+
private config;
|
|
965
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
963
966
|
list(params?: ListParams): Promise<ListResponse<Program>>;
|
|
964
967
|
listTemplates(params?: ListParams): Promise<ListResponse<Program>>;
|
|
965
968
|
create(request: CreateProgramRequest): Promise<Program>;
|
|
@@ -977,7 +980,8 @@ declare class ProgramsResource {
|
|
|
977
980
|
|
|
978
981
|
declare class MetricsResource {
|
|
979
982
|
private http;
|
|
980
|
-
|
|
983
|
+
private config;
|
|
984
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
981
985
|
list(): Promise<ListResponse<Metric>>;
|
|
982
986
|
get(metricId: string): Promise<Metric>;
|
|
983
987
|
getByCategory(category: string): Promise<ListResponse<Metric>>;
|
|
@@ -994,7 +998,8 @@ declare class MetricsResource {
|
|
|
994
998
|
|
|
995
999
|
declare class GoalsResource {
|
|
996
1000
|
private http;
|
|
997
|
-
|
|
1001
|
+
private config;
|
|
1002
|
+
constructor(http: HttpClient, config: ResolvedConfig);
|
|
998
1003
|
list(): Promise<ListResponse<UserGoal>>;
|
|
999
1004
|
getByDate(date: string): Promise<ListResponse<UserGoal>>;
|
|
1000
1005
|
create(request: CreateUserGoalRequest): Promise<UserGoal>;
|