-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from kabaros/feature/waist-circumference
Add support for waist circumference
- Loading branch information
Showing
10 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# getLatestWaistCircumference | ||
|
||
Get the most recent waist circumference value. Waist circumference is available in iOS 11.0+. | ||
|
||
On success, the callback function will be provided with a `waistCircumference` object containing the waist circumference `value`, and the `startDate` and `endDate` of the waist circumference sample. _Note: startDate and endDate will be the same as waist circumference samples are saved at a specific point in time._ | ||
|
||
```javascript | ||
AppleHealthKit.getLatestWaistCircumference({}, (err: string, results: HealthValue) => { | ||
if (err) { | ||
console.log('error getting latest waist circumference: ', err) | ||
return | ||
} | ||
console.log(results) | ||
}) | ||
``` | ||
|
||
Example output: | ||
|
||
```json | ||
{ | ||
"value": 39, | ||
"startDate": "2021-06-15T11:08:05.366+0100", | ||
"endDate": "2021-06-15T11:08:05.366+0100" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# getWaistCircumferenceSamples | ||
|
||
Query for waist circumference samples. The options object is used to setup a query to retrieve relevant samples. Waist circumference is available in iOS 11.0+. | ||
|
||
Example input options: | ||
|
||
```javascript | ||
let options = { | ||
unit: 'inch', // optional; default 'inch' | ||
startDate: new Date(2021, 0, 0).toISOString(), // required | ||
endDate: new Date().toISOString(), // optional; default now | ||
ascending: false, // optional; default false | ||
limit: 10, // optional; default no limit | ||
} | ||
``` | ||
|
||
Call the method: | ||
|
||
```javascript | ||
AppleHealthKit.getWaistCircumferenceSamples( | ||
options, | ||
(err: Object, results: Array<HealthValue>) => { | ||
if (err) { | ||
return | ||
} | ||
console.log(results) | ||
}, | ||
) | ||
``` | ||
|
||
Example output: | ||
|
||
```json | ||
[ | ||
{ | ||
"value": 39.02, | ||
"startDate": "2016-06-29T17:55:00.000-0400", | ||
"endDate": "2016-06-29T17:55:00.000-0400" | ||
}, | ||
{ | ||
"value": 39, | ||
"startDate": "2016-03-12T13:22:00.000-0400", | ||
"endDate": "2016-03-12T13:22:00.000-0400" | ||
} | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# saveWaistCircumference | ||
|
||
save a numeric waist circumference value to Healthkit. Waist circumference is available in iOS 11.0+. | ||
|
||
`saveWaistCircumference` accepts an options object containing a numeric waist circumference value: | ||
|
||
Example input options: | ||
|
||
```javascript | ||
let options = { | ||
value: 39, // Inches | ||
} | ||
``` | ||
|
||
Call the method: | ||
|
||
```javascript | ||
AppleHealthKit.saveWaistCircumference( | ||
(options: HealthValueOptions), | ||
(err: Object, results: number) => { | ||
if (err) { | ||
return | ||
} | ||
// waist circumference successfully saved | ||
}, | ||
) | ||
``` | ||
|
||
Example output: | ||
|
||
```json | ||
39 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters