@felipeclopes/capacitor-healthkit
v6.0.2
Published
Capacitor plugin to read data from and write data to Apple Health
Downloads
28
Readme
@perfood/capacitor-healthkit v2
This is a complete re-write of the original plugin and still work in progress. v2 will have a complete new API and some new features. By far not everything has been implemented yet. You can test the most recent release of v2 by installing @perfood/capacitor-healthkit@next
.
Install
npm install @perfood/capacitor-healthkit@next
npx cap sync
API
requestAuthorization(...)
isAvailable()
getAuthorizationStatus(...)
getStatisticsCollection(...)
getBodyMassEntries(...)
getWorkouts(...)
- Interfaces
- Type Aliases
requestAuthorization(...)
requestAuthorization(options: RequestAuthorizationOptions) => Promise<void>
| Param | Type |
| ------------- | ----------------------------------------------------------------------------------- |
| options
| RequestAuthorizationOptions |
isAvailable()
isAvailable() => Promise<void>
getAuthorizationStatus(...)
getAuthorizationStatus(options: GetAuthorizationStatusOptions) => Promise<{ status: AuthorizationStatus; }>
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------- |
| options
| GetAuthorizationStatusOptions |
Returns: Promise<{ status: AuthorizationStatus; }>
getStatisticsCollection(...)
getStatisticsCollection(options: StatisticsCollectionOptions) => Promise<StatisticsCollectionOutput>
| Param | Type |
| ------------- | ----------------------------------------------------------------------------------- |
| options
| StatisticsCollectionOptions |
Returns: Promise<StatisticsCollectionOutput>
getBodyMassEntries(...)
getBodyMassEntries(options: BodyMassQueryOptions) => Promise<BodyMassQueryOutput>
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options
| BodyMassQueryOptions |
Returns: Promise<BodyMassQueryOutput>
getWorkouts(...)
getWorkouts(options: WorkoutsQueryOptions) => Promise<WorkoutsQueryOutput>
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options
| WorkoutsQueryOptions |
Returns: Promise<WorkoutsQueryOutput>
Interfaces
RequestAuthorizationOptions
| Prop | Type |
| ----------- | --------------------- |
| all
| string[] |
| read
| string[] |
| write
| string[] |
GetAuthorizationStatusOptions
| Prop | Type |
| ---------------- | ------------------- |
| sampleType
| string |
StatisticsCollectionOutput
| Prop | Type |
| ---------- | --------------------------------------------------------------------- |
| data
| { startDate: string; endDate: string; value: number; }[] |
StatisticsCollectionOptions
| Prop | Type |
| ---------------------------- | ----------------------------------------------------------------------------------------------- |
| startDate
| string |
| endDate
| string |
| anchorDate
| string |
| interval
| StatisticsCollectionQueryInterval |
| quantityTypeSampleName
| QuantityType |
StatisticsCollectionQueryInterval
| Prop | Type |
| ----------- | ------------------------------------------------------------------------- |
| unit
| 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' |
| value
| number |
BodyMassQueryOutput
| Prop | Type |
| ---------- | ----------------------------------------------------------------------------------------------------------------------- |
| data
| { date: string; value: number; unit: string; uuid: string; sourceName: string; sourceBundleId: string; }[] |
BodyMassQueryOptions
| Prop | Type |
| --------------- | ------------------- |
| startDate
| string |
| endDate
| string |
| limit
| number |
WorkoutsQueryOutput
| Prop | Type |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| data
| { uuid: string; startDate: string; endDate: string; duration: number; device?: HealthKitDevice; source: string; sourceBundleId: string; workoutActivityType: string; workoutActivityTypeId: number; totalEnergyBurned?: number; totalDistance?: number; totalFlightsClimbed?: number; totalSwimmingStrokeCount?: number; }[] |
HealthKitDevice
| Prop | Type |
| ------------------------- | ------------------- |
| name
| string |
| model
| string |
| manufacturer
| string |
| hardwareVersion
| string |
| softwareVersion
| string |
| firmwareVersion
| string |
| localIdentifier
| string |
| udiDeviceIdentifier
| string |
WorkoutsQueryOptions
| Prop | Type |
| --------------- | ------------------- |
| startDate
| string |
| endDate
| string |
| limit
| number |
Type Aliases
AuthorizationStatus
'notDetermined' | 'sharingDenied' | 'sharingAuthorized'
QuantityType
'stepCount'