import type { Activity, SleepData, StressData, BodyBattery, HRVData, WeightData } from '../types'; import type { GarminHeartRateThresholds } from './garmin-profile-thresholds'; import type { GarminLactateThreshold } from './garmin-lactate-threshold'; import type { IGarminTokens } from 'ts-garmin'; /** Validate the complete provider report; never silently keep only some zones. */ export declare function parseActivityZoneTimes(value: unknown): ActivityZoneTime[]; /** * Garmin Connect's activity details as plain samples. The endpoint sends one * array of values per sample, in the order `metricDescriptors` gives; timer * time is `sumDuration` (seconds), falling back to wall time from * `directTimestamp` (milliseconds) with any gap over a minute counted as a * pause. Samples with no time at all are dropped. */ export declare function parseActivityDetails(details: unknown): ActivityDetailSample[]; /** Whether an error from Connect is a 404: the thing asked about is not there. */ export declare function isGarminNotFound(error: unknown): boolean; export declare function createGarminConnectClient(config?: GarminConnectConfig): GarminConnectClient; export declare interface GarminConnectConfig { username: string password: string } /** A downloaded activity file, held in memory. */ export declare interface OriginalActivityFile { bytes: Uint8Array filename: string } export declare interface GarminActivitySummary { activityId: number activityName: string activityType: { typeKey: string } startTimeLocal: string startTimeGMT: string duration: number distance: number calories: number averageHR?: number maxHR?: number averageSpeed?: number maxSpeed?: number elevationGain?: number elevationLoss?: number averageRunningCadenceInStepsPerMinute?: number maxRunningCadenceInStepsPerMinute?: number avgPower?: number maxPower?: number normPower?: number trainingStressScore?: number intensityFactor?: number aerobicTrainingEffect?: number anaerobicTrainingEffect?: number trainingEffectLabel?: string activityTrainingLoad?: number vO2MaxValue?: number } export declare interface DailyHeartRate { date: Date restingHeartRate?: number minHeartRate?: number maxHeartRate?: number avgHeartRate?: number samples?: Array<{ timestamp: Date, heartRate: number }> } export declare interface DailySummary { date: Date heartRate?: DailyHeartRate sleep?: SleepData stress?: StressData bodyBattery?: BodyBattery hrv?: HRVData steps?: { total: number goal?: number distance?: number calories?: number } } /** One recorded sample from an activity's details. */ export declare interface ActivityDetailSample { seconds: number heartRate: number | null power: number | null speed: number | null } /** Device-recorded zone membership, including its original lower boundary. */ export declare interface ActivityZoneTime { zone: number seconds: number low: number } export declare interface ActivityZoneReport { duration: number heartRate: ActivityZoneTime[] power: ActivityZoneTime[] } /** * A workout as Garmin Connect's workout service takes it: the JSON its own * workout editor sends to `/workout-service/workout`. Typed loosely on * purpose: the vocabulary (sport, step type, end condition and target ids) is * Garmin's and undocumented, so callers build it and this only carries it. */ export declare interface GarminConnectWorkout { workoutName: string description?: string | null sportType: { sportTypeId: number, sportTypeKey: string, displayOrder?: number } workoutSegments: Array<{ segmentOrder: number sportType: { sportTypeId: number, sportTypeKey: string, displayOrder?: number } workoutSteps: Array> }> [key: string]: unknown } /** A workout Connect holds, as far as a caller needs to keep track of it. */ export declare interface GarminConnectWorkoutRef { workoutId: string } /** One scheduling of a workout on the athlete's Connect calendar. */ export declare interface GarminConnectSchedule { workoutScheduleId: string | null date: string } /** Opaque provider sessions: store encrypted and bind them to their account. */ export type GarminConnectSession = IGarminTokens; /** * What Connect can export an activity as. `zip` is "Export Original", the * device's own recording; the rest are Garmin's conversions. */ export type GarminExportFormat = 'zip' | 'tcx' | 'gpx' | 'kml'; export declare class GarminConnectClient { constructor(config?: GarminConnectConfig); login(username?: string, password?: string): Promise; restoreSession(session: GarminConnectSession): void; exportSession(): GarminConnectSession; getUserProfile(): Promise<{ displayName: string, profileId: string }>; getActivities(start?: number, limit?: number): Promise; getTrainingReadiness(date: string): Promise; getEnduranceScore(date: string): Promise; getTrainingStatus(date: string): Promise; getLatestLactateThreshold(): Promise; getHeartRateThresholds(): Promise; getCyclingFtp(): Promise; getMaxMetrics(start: string, end: string): Promise; getHydrationData(date: string): Promise; getActivity(activityId: number): Promise; getActivityDetails(activityId: number, maxSamples?: number): Promise; getActivityTimeInZones(activityId: number): Promise; getActivityHeartRateTimeInZones(activityId: number): Promise; getActivityPowerTimeInZones(activityId: number): Promise; downloadOriginalActivity(activityId: number, format?: GarminExportFormat): Promise; downloadActivityFit(activityId: number, outputDir: string): Promise; createWorkout(workout: GarminConnectWorkout): Promise; getWorkout(workoutId: string): Promise | null>; updateWorkout(workoutId: string, workout: GarminConnectWorkout): Promise; deleteWorkout(workoutId: string): Promise; scheduleWorkout(workoutId: string, date: string): Promise; unscheduleWorkout(workoutScheduleId: string): Promise; getDailySummary(date: Date): Promise; getHeartRateData(date: Date): Promise; getSleepData(date: Date): Promise; getStepsData(date: Date): Promise<{ total: number, goal?: number, distance?: number, calories?: number } | undefined>; getStressData(date: Date): Promise; getBodyBatteryData(date: Date): Promise; getHrvData(date: Date): Promise; getWeightData(date: Date): Promise; getWeightReadings(date: Date): Promise; }