react-native-healthkit-bridge
Version:
A comprehensive React Native bridge for Apple HealthKit with TypeScript support, advanced authorization, and flexible data queries
66 lines (65 loc) • 1.75 kB
TypeScript
import { QuantityTypeIdentifier } from '../types/healthkit.types';
/**
* 📊 EXAMPLE: Complete Health Data Flow
*
* This example shows how to:
* 1. Check authorization for specific data
* 2. Request authorization only when needed
* 3. Fetch data only for authorized types
* 4. Handle errors and authorization status
*/
export declare class HealthDataWorkflowExample {
private bridge;
constructor();
/**
* 📋 EXAMPLE 1: Check and Get Steps Data
*/
getStepsData(): Promise<{
authorized: boolean;
data: number;
message: string;
}>;
/**
* 📋 EXAMPLE 2: Complete Flow for Multiple Types
*/
getHealthDashboard(): Promise<any>;
/**
* 📋 EXAMPLE 3: Check and Request Smart Authorization
*/
requestAuthorizationForTypes(types: QuantityTypeIdentifier[]): Promise<{
success: boolean;
authorizedTypes: string[];
deniedTypes: string[];
message: string;
}>;
/**
* 📋 EXAMPLE 4: Complete Health Data Flow
*/
getCompleteHealthData(): Promise<{
success: boolean;
data: any;
message: string;
}>;
}
/**
* 📋 HOW TO USE:
*
* ```typescript
* const example = new HealthDataWorkflowExample();
*
* // Get steps data
* const stepsResult = await example.getStepsData();
*
* // Check and request authorization for specific types
* const authResult = await example.requestAuthorizationForTypes([
* QuantityTypeIdentifier.StepCount,
* QuantityTypeIdentifier.HeartRate
* ]);
*
* // Get complete dashboard
* const dashboardData = await example.getHealthDashboard();
*
* // Complete flow
* const completeResult = await example.getCompleteHealthData();
* ```
*/