natively 2.19.1 → 2.20.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.
|
@@ -7,5 +7,36 @@ export declare class NativelyHealth {
|
|
|
7
7
|
getStatisticQuantity(data_type: string, interval: string, start_date?: Date, end_date?: Date, callback?: Function): void;
|
|
8
8
|
getDailySleepAnalysis(start_date?: Date, end_date?: Date, limit?: number, callback?: Function): void;
|
|
9
9
|
getWorkouts(start_date?: Date, end_date?: Date, limit?: number, callback?: Function): void;
|
|
10
|
+
writeWorkout(workout: {
|
|
11
|
+
start_date?: Date;
|
|
12
|
+
end_date?: Date;
|
|
13
|
+
duration?: number;
|
|
14
|
+
activity_type?: string;
|
|
15
|
+
total_energy_burned?: number;
|
|
16
|
+
total_energy_burned_unit?: string;
|
|
17
|
+
total_distance?: number;
|
|
18
|
+
total_distance_unit?: string;
|
|
19
|
+
total_swimming_stroke_count?: number;
|
|
20
|
+
total_swimming_stroke_count_unit?: string;
|
|
21
|
+
total_flights_climbed?: number;
|
|
22
|
+
total_flights_climbed_unit?: string;
|
|
23
|
+
metadata?: any;
|
|
24
|
+
events?: any[];
|
|
25
|
+
uuid?: string;
|
|
26
|
+
identifier?: string;
|
|
27
|
+
}, callback?: Function): void;
|
|
28
|
+
writeNutrition(nutrition: {
|
|
29
|
+
items?: Array<{
|
|
30
|
+
start_date?: Date;
|
|
31
|
+
end_date?: Date;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}>;
|
|
34
|
+
start_date?: Date;
|
|
35
|
+
end_date?: Date;
|
|
36
|
+
identifier?: string;
|
|
37
|
+
value?: number;
|
|
38
|
+
unit?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}, callback?: Function): void;
|
|
10
41
|
getActivitySummary(start_date?: Date, end_date?: Date, callback?: Function): void;
|
|
11
42
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -61,6 +63,38 @@ export class NativelyHealth {
|
|
|
61
63
|
}
|
|
62
64
|
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 21, callback, "health_get_workouts", obj);
|
|
63
65
|
}
|
|
66
|
+
writeWorkout(workout, callback) {
|
|
67
|
+
var obj = _objectSpread({}, workout);
|
|
68
|
+
if ((workout === null || workout === void 0 ? void 0 : workout.start_date) instanceof Date) {
|
|
69
|
+
obj.start_date = workout.start_date.getTime();
|
|
70
|
+
}
|
|
71
|
+
if ((workout === null || workout === void 0 ? void 0 : workout.end_date) instanceof Date) {
|
|
72
|
+
obj.end_date = workout.end_date.getTime();
|
|
73
|
+
}
|
|
74
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, callback, "health_write_workout", obj);
|
|
75
|
+
}
|
|
76
|
+
writeNutrition(nutrition, callback) {
|
|
77
|
+
var obj = _objectSpread({}, nutrition);
|
|
78
|
+
if ((nutrition === null || nutrition === void 0 ? void 0 : nutrition.start_date) instanceof Date) {
|
|
79
|
+
obj.start_date = nutrition.start_date.getTime();
|
|
80
|
+
}
|
|
81
|
+
if ((nutrition === null || nutrition === void 0 ? void 0 : nutrition.end_date) instanceof Date) {
|
|
82
|
+
obj.end_date = nutrition.end_date.getTime();
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(nutrition === null || nutrition === void 0 ? void 0 : nutrition.items)) {
|
|
85
|
+
obj.items = nutrition.items.map(item => {
|
|
86
|
+
var mappedItem = _objectSpread({}, item);
|
|
87
|
+
if ((item === null || item === void 0 ? void 0 : item.start_date) instanceof Date) {
|
|
88
|
+
mappedItem.start_date = item.start_date.getTime();
|
|
89
|
+
}
|
|
90
|
+
if ((item === null || item === void 0 ? void 0 : item.end_date) instanceof Date) {
|
|
91
|
+
mappedItem.end_date = item.end_date.getTime();
|
|
92
|
+
}
|
|
93
|
+
return mappedItem;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, callback, "health_write_nutrition", obj);
|
|
97
|
+
}
|
|
64
98
|
getActivitySummary(start_date, end_date, callback) {
|
|
65
99
|
var obj = {};
|
|
66
100
|
if (start_date) {
|