健康数据接口文档 (Health Data API)
本文档定义了健康数据交互的核心 API 方法,用于获取用户的运动、睡眠、心率及生命体征数据。
- 核心方法:数据查询
`fetchStatistics(params, callback)`
用于查询指定类型的健康数据统计。
**参数说明 (`params`):**
| 参数名 | 类型 | 说明 |
| :--- | :--- | :--- |
| `identifier` | `String` | 数据类别 (`stepCount`, `heartRate`, `bodyTemperature`, `oxygenSaturation`, `sleep`) |
| `startDate` | `Date` | 开始时间戳(秒级 10 位,如 `1782145920`) |
| `endDate` | `Date` | 结束时间戳(秒级 10 位,如 `1782145920`) |
| `intervalType` | `String` | 时间间隔(`day`:天, `week`:周, `month`:月) |
**使用示例:**
```javascript
api.fetchStatistics({
identifier: 'stepCount',
startDate: 1782145920,
endDate: 1782158400,
intervalType: 'day'
}, (err, data) => {
// 处理回调逻辑
});