mirror of
https://github.com/sstent/go-garth.git
synced 2026-04-04 09:02:46 +00:00
970 B
970 B
System Architecture
Overview
The Garth client library follows a layered architecture with clear separation between:
- API Client Layer
- Data Models Layer
- Stats Endpoints Layer
- Utilities Layer
Key Components
- Client: Handles authentication, session management, and HTTP requests
- Data Models: Represent Garmin API responses (e.g., DailyBodyBatteryStress)
- Stats: Implement endpoints for different metrics (steps, stress, etc.)
- Test Utilities: Mock implementations for testing
Data Flow
- User authenticates via
client.Login() - Session tokens are stored in
Clientstruct - Stats requests are made through
stats.Stats.List()method - Responses are parsed into data models
- Sessions can be saved/loaded using
SaveSession()/LoadSession()
Critical Paths
- Authentication:
garth/sso/sso.go - API Requests:
garth/client/client.go - Stats Implementation:
garth/stats/base.go - Data Models:
garth/types/types.go