@gooin/garmin-connect 1.4.4 → 1.6.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.
Files changed (38) hide show
  1. package/README.md +225 -35
  2. package/dist/common/CFClient.d.ts +22 -0
  3. package/dist/common/CFClient.js +137 -140
  4. package/dist/common/CFClient.js.map +1 -0
  5. package/dist/common/DateUtils.d.ts +1 -0
  6. package/dist/common/DateUtils.js +11 -10
  7. package/dist/common/DateUtils.js.map +1 -0
  8. package/dist/common/HttpClient.d.ts +34 -0
  9. package/dist/common/HttpClient.js +299 -0
  10. package/dist/common/HttpClient.js.map +1 -0
  11. package/dist/garmin/GarminConnect.d.ts +40 -0
  12. package/dist/garmin/GarminConnect.js +178 -438
  13. package/dist/garmin/GarminConnect.js.map +1 -0
  14. package/dist/garmin/UrlClass.d.ts +25 -0
  15. package/dist/garmin/UrlClass.js +64 -0
  16. package/dist/garmin/UrlClass.js.map +1 -0
  17. package/dist/garmin/Urls.d.ts +64 -0
  18. package/dist/garmin/Urls.js +104 -102
  19. package/dist/garmin/Urls.js.map +1 -0
  20. package/dist/garmin/types.d.ts +706 -0
  21. package/dist/garmin/types.js +17 -0
  22. package/dist/garmin/types.js.map +1 -0
  23. package/dist/garmin/workouts/Running.d.ts +16 -0
  24. package/dist/garmin/workouts/Running.js +47 -53
  25. package/dist/garmin/workouts/Running.js.map +1 -0
  26. package/dist/garmin/workouts/templates/RunningTemplate.d.ts +68 -0
  27. package/dist/garmin/workouts/templates/RunningTemplate.js +78 -48
  28. package/dist/garmin/workouts/templates/RunningTemplate.js.map +1 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +9 -3
  31. package/dist/index.js.map +1 -0
  32. package/dist/utils.d.ts +3 -0
  33. package/dist/utils.js +46 -0
  34. package/dist/utils.js.map +1 -0
  35. package/examples/example.js +21 -6
  36. package/package.json +66 -51
  37. package/dist/common/Client.js +0 -189
  38. package/dist/garmin/workouts/index.js +0 -5
@@ -0,0 +1,16 @@
1
+ import { IRunningWorkout } from './templates/RunningTemplate';
2
+ export default class Running {
3
+ private data;
4
+ constructor();
5
+ get name(): string;
6
+ set name(name: string);
7
+ get distance(): number;
8
+ set distance(meters: number);
9
+ get workoutId(): string | undefined;
10
+ set workoutId(workoutId: string | undefined);
11
+ get description(): string | undefined;
12
+ set description(description: string | undefined);
13
+ isValid(): boolean;
14
+ toJson(): IRunningWorkout;
15
+ toString(): string;
16
+ }
@@ -1,53 +1,47 @@
1
- const template = require('./templates/RunningTemplate');
2
-
3
- class Running {
4
- constructor() {
5
- this.data = template();
6
- }
7
-
8
- get name() {
9
- return this.data.workoutName;
10
- }
11
-
12
- set name(name) {
13
- this.data.workoutName = `${name}`;
14
- }
15
-
16
- get distance() {
17
- return this.data.workoutSegments[0].workoutSteps[0].endConditionValue;
18
- }
19
-
20
- set distance(meters) {
21
- this.data.workoutSegments[0].workoutSteps[0].endConditionValue = Math.round(meters);
22
- }
23
-
24
- get workoutId() {
25
- return this.data.workoutId;
26
- }
27
-
28
- set workoutId(workoutId) {
29
- this.data.workoutId = workoutId;
30
- }
31
-
32
- get description() {
33
- return this.data.description;
34
- }
35
-
36
- set description(description) {
37
- this.data.description = description;
38
- }
39
-
40
- isValid() {
41
- return !!(this.name && this.distance);
42
- }
43
-
44
- toJson() {
45
- return this.data;
46
- }
47
-
48
- toString() {
49
- return `${this.name}, ${(this.distance / 1000).toFixed(2)}km`;
50
- }
51
- }
52
-
53
- module.exports = Running;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const RunningTemplate_1 = __importDefault(require("./templates/RunningTemplate"));
7
+ class Running {
8
+ constructor() {
9
+ this.data = (0, RunningTemplate_1.default)();
10
+ }
11
+ get name() {
12
+ return this.data.workoutName;
13
+ }
14
+ set name(name) {
15
+ this.data.workoutName = `${name}`;
16
+ }
17
+ get distance() {
18
+ return (this.data.workoutSegments[0].workoutSteps[0].endConditionValue || 0);
19
+ }
20
+ set distance(meters) {
21
+ this.data.workoutSegments[0].workoutSteps[0].endConditionValue =
22
+ Math.round(meters);
23
+ }
24
+ get workoutId() {
25
+ return this.data.workoutId;
26
+ }
27
+ set workoutId(workoutId) {
28
+ this.data.workoutId = workoutId;
29
+ }
30
+ get description() {
31
+ return this.data.description;
32
+ }
33
+ set description(description) {
34
+ this.data.description = description;
35
+ }
36
+ isValid() {
37
+ return !!(this.name && this.distance);
38
+ }
39
+ toJson() {
40
+ return this.data;
41
+ }
42
+ toString() {
43
+ return `${this.name}, ${(this.distance / 1000).toFixed(2)}km`;
44
+ }
45
+ }
46
+ exports.default = Running;
47
+ //# sourceMappingURL=Running.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Running.js","sourceRoot":"","sources":["../../../src/garmin/workouts/Running.ts"],"names":[],"mappings":";;;;;AAAA,kFAAwE;AAExE,MAAqB,OAAO;IAExB;QACI,IAAI,CAAC,IAAI,GAAG,IAAA,yBAAQ,GAAE,CAAC;IAC3B,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,IAAI,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,IAAI,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,CACH,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,CACtE,CAAC;IACN,CAAC;IAED,IAAI,QAAQ,CAAC,MAAc;QACvB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAiB;YAC1D,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,SAAS,CAAC,SAAS;QACnB,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IACpC,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,IAAI,WAAW,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACxC,CAAC;IAED,OAAO;QACH,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,QAAQ;QACJ,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,CAAC;CACJ;AApDD,0BAoDC"}
@@ -0,0 +1,68 @@
1
+ export interface ISportType {
2
+ sportTypeId: number;
3
+ sportTypeKey: SportTypeKey;
4
+ }
5
+ declare enum SportTypeKey {
6
+ running = "running"
7
+ }
8
+ export interface IRunningWorkout {
9
+ workoutId: string | undefined;
10
+ description: string | undefined;
11
+ sportType: ISportType;
12
+ workoutName: string;
13
+ workoutSegments: IWorkoutSegment[];
14
+ }
15
+ export interface IWorkoutSegment {
16
+ segmentOrder: number;
17
+ sportType: ISportType;
18
+ workoutSteps: IWorkoutStep[];
19
+ }
20
+ export interface IWorkoutStep {
21
+ type: WorkoutStepType;
22
+ stepId: unknown;
23
+ stepOrder: number;
24
+ childStepId: unknown;
25
+ description: string | null;
26
+ stepType: IStepType;
27
+ endCondition: IEndCondition;
28
+ preferredEndConditionUnit: IPreferredEndConditionUnit;
29
+ endConditionValue: number | null;
30
+ endConditionCompare: null;
31
+ endConditionZone: null;
32
+ targetType: ITargetType;
33
+ targetValueOne: null;
34
+ targetValueTwo: null;
35
+ zoneNumber: null;
36
+ }
37
+ declare enum WorkoutStepType {
38
+ executableStepDTO = "ExecutableStepDTO"
39
+ }
40
+ export interface IStepType {
41
+ stepTypeId: number;
42
+ stepTypeKey: StepTypeKey;
43
+ }
44
+ declare enum StepTypeKey {
45
+ interval = "interval"
46
+ }
47
+ export interface IEndCondition {
48
+ conditionTypeKey: ConditionTypeKey;
49
+ conditionTypeId: number;
50
+ }
51
+ declare enum ConditionTypeKey {
52
+ distance = "distance"
53
+ }
54
+ export interface IPreferredEndConditionUnit {
55
+ unitKey: UnitKey;
56
+ }
57
+ declare enum UnitKey {
58
+ kilometer = "kilometer"
59
+ }
60
+ export interface ITargetType {
61
+ workoutTargetTypeId: number;
62
+ workoutTargetTypeKey: WorkoutTargetTypeKey;
63
+ }
64
+ declare enum WorkoutTargetTypeKey {
65
+ noTarget = "no.target"
66
+ }
67
+ export default function (): IRunningWorkout;
68
+ export {};
@@ -1,48 +1,78 @@
1
- module.exports = () => (
2
- {
3
- sportType: {
4
- sportTypeId: 1,
5
- sportTypeKey: 'running',
6
- },
7
- workoutName: null,
8
- workoutSegments: [
9
- {
10
- segmentOrder: 1,
11
- sportType: {
12
- sportTypeId: 1,
13
- sportTypeKey: 'running',
14
- },
15
- workoutSteps: [
16
- {
17
- type: 'ExecutableStepDTO',
18
- stepId: null,
19
- stepOrder: 1,
20
- childStepId: null,
21
- description: null,
22
- stepType: {
23
- stepTypeId: 3,
24
- stepTypeKey: 'interval',
25
- },
26
- endCondition: {
27
- conditionTypeKey: 'distance',
28
- conditionTypeId: 3,
29
- },
30
- preferredEndConditionUnit: {
31
- unitKey: 'kilometer',
32
- },
33
- endConditionValue: null,
34
- endConditionCompare: null,
35
- endConditionZone: null,
36
- targetType: {
37
- workoutTargetTypeId: 1,
38
- workoutTargetTypeKey: 'no.target',
39
- },
40
- targetValueOne: null,
41
- targetValueTwo: null,
42
- zoneNumber: null,
43
- },
44
- ],
45
- },
46
- ],
47
- }
48
- );
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var SportTypeKey;
4
+ (function (SportTypeKey) {
5
+ SportTypeKey["running"] = "running";
6
+ })(SportTypeKey || (SportTypeKey = {}));
7
+ var WorkoutStepType;
8
+ (function (WorkoutStepType) {
9
+ WorkoutStepType["executableStepDTO"] = "ExecutableStepDTO";
10
+ })(WorkoutStepType || (WorkoutStepType = {}));
11
+ var StepTypeKey;
12
+ (function (StepTypeKey) {
13
+ StepTypeKey["interval"] = "interval";
14
+ })(StepTypeKey || (StepTypeKey = {}));
15
+ var ConditionTypeKey;
16
+ (function (ConditionTypeKey) {
17
+ ConditionTypeKey["distance"] = "distance";
18
+ })(ConditionTypeKey || (ConditionTypeKey = {}));
19
+ var UnitKey;
20
+ (function (UnitKey) {
21
+ UnitKey["kilometer"] = "kilometer";
22
+ })(UnitKey || (UnitKey = {}));
23
+ var WorkoutTargetTypeKey;
24
+ (function (WorkoutTargetTypeKey) {
25
+ WorkoutTargetTypeKey["noTarget"] = "no.target";
26
+ })(WorkoutTargetTypeKey || (WorkoutTargetTypeKey = {}));
27
+ function default_1() {
28
+ return {
29
+ description: undefined,
30
+ workoutId: undefined,
31
+ sportType: {
32
+ sportTypeId: 1,
33
+ sportTypeKey: SportTypeKey.running
34
+ },
35
+ workoutName: '',
36
+ workoutSegments: [
37
+ {
38
+ segmentOrder: 1,
39
+ sportType: {
40
+ sportTypeId: 1,
41
+ sportTypeKey: SportTypeKey.running
42
+ },
43
+ workoutSteps: [
44
+ {
45
+ type: WorkoutStepType.executableStepDTO,
46
+ stepId: null,
47
+ stepOrder: 1,
48
+ childStepId: null,
49
+ description: null,
50
+ stepType: {
51
+ stepTypeId: 3,
52
+ stepTypeKey: StepTypeKey.interval
53
+ },
54
+ endCondition: {
55
+ conditionTypeKey: ConditionTypeKey.distance,
56
+ conditionTypeId: 3
57
+ },
58
+ preferredEndConditionUnit: {
59
+ unitKey: UnitKey.kilometer
60
+ },
61
+ endConditionValue: null,
62
+ endConditionCompare: null,
63
+ endConditionZone: null,
64
+ targetType: {
65
+ workoutTargetTypeId: 1,
66
+ workoutTargetTypeKey: WorkoutTargetTypeKey.noTarget
67
+ },
68
+ targetValueOne: null,
69
+ targetValueTwo: null,
70
+ zoneNumber: null
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+ };
76
+ }
77
+ exports.default = default_1;
78
+ //# sourceMappingURL=RunningTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunningTemplate.js","sourceRoot":"","sources":["../../../../src/garmin/workouts/templates/RunningTemplate.ts"],"names":[],"mappings":";;AAKA,IAAK,YAEJ;AAFD,WAAK,YAAY;IACb,mCAAmB,CAAA;AACvB,CAAC,EAFI,YAAY,KAAZ,YAAY,QAEhB;AAkCD,IAAK,eAEJ;AAFD,WAAK,eAAe;IAChB,0DAAuC,CAAA;AAC3C,CAAC,EAFI,eAAe,KAAf,eAAe,QAEnB;AAOD,IAAK,WAEJ;AAFD,WAAK,WAAW;IACZ,oCAAqB,CAAA;AACzB,CAAC,EAFI,WAAW,KAAX,WAAW,QAEf;AAOD,IAAK,gBAEJ;AAFD,WAAK,gBAAgB;IACjB,yCAAqB,CAAA;AACzB,CAAC,EAFI,gBAAgB,KAAhB,gBAAgB,QAEpB;AAMD,IAAK,OAEJ;AAFD,WAAK,OAAO;IACR,kCAAuB,CAAA;AAC3B,CAAC,EAFI,OAAO,KAAP,OAAO,QAEX;AAOD,IAAK,oBAEJ;AAFD,WAAK,oBAAoB;IACrB,8CAAsB,CAAA;AAC1B,CAAC,EAFI,oBAAoB,KAApB,oBAAoB,QAExB;AAED;IACI,OAAO;QACH,WAAW,EAAE,SAAS;QACtB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE;YACP,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,YAAY,CAAC,OAAO;SACrC;QACD,WAAW,EAAE,EAAE;QACf,eAAe,EAAE;YACb;gBACI,YAAY,EAAE,CAAC;gBACf,SAAS,EAAE;oBACP,WAAW,EAAE,CAAC;oBACd,YAAY,EAAE,YAAY,CAAC,OAAO;iBACrC;gBACD,YAAY,EAAE;oBACV;wBACI,IAAI,EAAE,eAAe,CAAC,iBAAiB;wBACvC,MAAM,EAAE,IAAI;wBACZ,SAAS,EAAE,CAAC;wBACZ,WAAW,EAAE,IAAI;wBACjB,WAAW,EAAE,IAAI;wBACjB,QAAQ,EAAE;4BACN,UAAU,EAAE,CAAC;4BACb,WAAW,EAAE,WAAW,CAAC,QAAQ;yBACpC;wBACD,YAAY,EAAE;4BACV,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ;4BAC3C,eAAe,EAAE,CAAC;yBACrB;wBACD,yBAAyB,EAAE;4BACvB,OAAO,EAAE,OAAO,CAAC,SAAS;yBAC7B;wBACD,iBAAiB,EAAE,IAAI;wBACvB,mBAAmB,EAAE,IAAI;wBACzB,gBAAgB,EAAE,IAAI;wBACtB,UAAU,EAAE;4BACR,mBAAmB,EAAE,CAAC;4BACtB,oBAAoB,EAAE,oBAAoB,CAAC,QAAQ;yBACtD;wBACD,cAAc,EAAE,IAAI;wBACpB,cAAc,EAAE,IAAI;wBACpB,UAAU,EAAE,IAAI;qBACnB;iBACJ;aACJ;SACJ;KACJ,CAAC;AACN,CAAC;AAjDD,4BAiDC"}
@@ -0,0 +1 @@
1
+ export { default as GarminConnect } from './garmin/GarminConnect';
package/dist/index.js CHANGED
@@ -1,3 +1,9 @@
1
- const GarminConnect = require('./garmin/GarminConnect');
2
-
3
- module.exports = { GarminConnect };
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GarminConnect = void 0;
7
+ var GarminConnect_1 = require("./garmin/GarminConnect");
8
+ Object.defineProperty(exports, "GarminConnect", { enumerable: true, get: function () { return __importDefault(GarminConnect_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAkE;AAAzD,+HAAA,OAAO,OAAiB"}
@@ -0,0 +1,3 @@
1
+ export declare const checkIsDirectory: (filePath: string) => boolean;
2
+ export declare const createDirectory: (directoryPath: string) => void;
3
+ export declare const writeToFile: (filePath: string, data: any) => void;
package/dist/utils.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.writeToFile = exports.createDirectory = exports.checkIsDirectory = void 0;
27
+ const fs = __importStar(require("node:fs"));
28
+ const checkIsDirectory = (filePath) => {
29
+ return fs.existsSync(filePath) && fs.lstatSync(filePath).isDirectory();
30
+ };
31
+ exports.checkIsDirectory = checkIsDirectory;
32
+ const createDirectory = (directoryPath) => {
33
+ fs.mkdirSync(directoryPath);
34
+ };
35
+ exports.createDirectory = createDirectory;
36
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
37
+ const writeToFile = (filePath, data) => {
38
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
+ // @ts-ignore
40
+ fs.writeFileSync(filePath, data, (error) => {
41
+ if (error)
42
+ throw error;
43
+ });
44
+ };
45
+ exports.writeToFile = writeToFile;
46
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAGvB,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAC1D,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3E,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEK,MAAM,eAAe,GAAG,CAAC,aAAqB,EAAQ,EAAE;IAC3D,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEF,6EAA6E;AACtE,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,IAAS,EAAQ,EAAE;IAC7D,6DAA6D;IAC7D,aAAa;IACb,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;QACvC,IAAI,KAAK;YAAE,MAAM,KAAK,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB"}
@@ -1,18 +1,33 @@
1
- const { GarminConnect } = require('garmin-connect');
1
+ const { GarminConnect } = require('../dist/index');
2
2
 
3
3
  // Has to be run in an async function to be able to use the await keyword
4
4
  const main = async () => {
5
5
  // Create a new Garmin Connect Client
6
- const GCClient = new GarminConnect();
6
+ const GCClient = new GarminConnect({
7
+ username: 'your-email',
8
+ password: 'your-password'
9
+ });
10
+
11
+ // TODO: Test China Domain
12
+ // China Domain
13
+ // const GCClient = new GarminConnect({
14
+ // username: 'your-email',
15
+ // password: 'your-password'
16
+ // }, 'garmin.cn');
7
17
 
8
18
  // Uses credentials from garmin.config.json or uses supplied params
9
- await GCClient.login('my.email@example.com', 'MySecretPassword');
19
+ await GCClient.login();
20
+
21
+ // // Get user info
22
+ // const info = await GCClient.getUserInfo();
10
23
 
11
- // Get user info
12
- const info = await GCClient.getUserInfo();
24
+ // Log info to make sure signin was successful
25
+ // console.log(info);
26
+ // // Get user settings
27
+ const settings = await GCClient.getUserSettings();
13
28
 
14
29
  // Log info to make sure signin was successful
15
- console.log(info);
30
+ console.log(settings);
16
31
  };
17
32
 
18
33
  // Run the code
package/package.json CHANGED
@@ -1,53 +1,68 @@
1
1
  {
2
- "name": "@gooin/garmin-connect",
3
- "version": "1.4.4",
4
- "description": "Makes it simple to interface with Garmin Connect to get or set any data point",
5
- "main": "./dist/index.js",
6
- "scripts": {
7
- "build": "rm -rf ./dist/ && mkdir ./dist/ && cp -r ./src/* ./dist/",
8
- "prepack": "npm run build"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/Pythe1337N/garmin-connect.git"
13
- },
14
- "keywords": [
15
- "garmin",
16
- "connect",
17
- "scraper",
18
- "weight",
19
- "running",
20
- "workout",
21
- "activity",
22
- "activities",
23
- "download",
24
- "downloader"
25
- ],
26
- "author": "Oskar Bernberg (Pythe1337N)",
27
- "license": "MIT",
28
- "files": [
29
- "dist/*",
30
- "examples/*"
31
- ],
32
- "devDependencies": {
33
- "eslint": "^8.13.0",
34
- "eslint-config-airbnb-base": "^15.0.0",
35
- "eslint-plugin-import": "^2.26.0",
36
- "eslint-plugin-jest": "^26.1.4",
37
- "pre-commit": "^1.2.2"
38
- },
39
- "precommit": "build",
40
- "homepage": "https://github.com/Pythe1337N/garmin-connect#readme",
41
- "bugs": {
42
- "url": "https://github.com/Pythe1337N/garmin-connect/issues"
43
- },
44
- "runkitExampleFilename": "./examples/example.js",
45
- "dependencies": {
46
- "app-root-path": "^3.0.0",
47
- "axios": "^0.26.1",
48
- "cloudscraper": "^4.6.0",
49
- "form-data": "^4.0.0",
50
- "qs": "^6.10.3",
51
- "request": "^2.88.2"
52
- }
2
+ "name": "@gooin/garmin-connect",
3
+ "version": "1.6.0",
4
+ "description": "Makes it simple to interface with Garmin Connect to get or set any data point",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc --build --clean && find ./dist -type d -empty -delete; tsc",
9
+ "build:windows": "tsc --build --clean && tsc",
10
+ "build:watch": "npm run build -- --watch",
11
+ "build:watch-windows": "npm run build:windows -- --watch",
12
+ "prettier:all": "prettier --write .",
13
+ "pretty": "pretty-quick --staged",
14
+ "prepack": "npm run build:windows"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Pythe1337N/garmin-connect.git"
19
+ },
20
+ "keywords": [
21
+ "garmin",
22
+ "connect",
23
+ "scraper",
24
+ "weight",
25
+ "running",
26
+ "workout",
27
+ "activity",
28
+ "activities",
29
+ "download",
30
+ "downloader"
31
+ ],
32
+ "author": "Oskar Bernberg (Pythe1337N)",
33
+ "license": "MIT",
34
+ "files": [
35
+ "dist/*",
36
+ "examples/*"
37
+ ],
38
+ "devDependencies": {
39
+ "@types/app-root-path": "^1.2.4",
40
+ "@types/lodash": "^4.14.199",
41
+ "@types/luxon": "^3.3.2",
42
+ "@types/node": "^18.11.15",
43
+ "@types/qs": "^6.9.7",
44
+ "@types/request-promise": "^4.1.48",
45
+ "pre-commit": "^1.2.2",
46
+ "prettier": "^2.8.1",
47
+ "pretty-quick": "^3.1.3",
48
+ "typescript": "^4.9.4"
49
+ },
50
+ "homepage": "https://github.com/Pythe1337N/garmin-connect#readme",
51
+ "bugs": {
52
+ "url": "https://github.com/Pythe1337N/garmin-connect/issues"
53
+ },
54
+ "runkitExampleFilename": "./examples/example.js",
55
+ "dependencies": {
56
+ "app-root-path": "^3.1.0",
57
+ "axios": "^1.5.1",
58
+ "cloudscraper": "^4.6.0",
59
+ "crypto": "^1.0.1",
60
+ "form-data": "^4.0.0",
61
+ "lodash": "^4.17.21",
62
+ "luxon": "^3.4.3",
63
+ "oauth-1.0a": "^2.2.6",
64
+ "qs": "^6.11.2",
65
+ "request": "^2.88.2"
66
+ },
67
+ "pre-commit": "pretty"
53
68
  }