Documentation
¶
Index ¶
- type APIError
- type BodyMeasurement
- type Client
- type Cycle
- type CycleScore
- type CycleService
- type ListParams
- type Option
- type PaginatedResponse
- type RateLimitInfo
- type Recovery
- type RecoveryScore
- type RecoveryService
- type ScoreState
- type Sleep
- type SleepNeeded
- type SleepScore
- type SleepService
- type SleepStages
- type UserProfile
- type UserService
- type Workout
- type WorkoutScore
- type WorkoutService
- type WorkoutZones
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
func (*APIError) IsRateLimited ¶
type BodyMeasurement ¶
type Client ¶
type Client struct {
User UserService
Cycle CycleService
Recovery RecoveryService
Sleep SleepService
Workout WorkoutService
// contains filtered or unexported fields
}
type Cycle ¶
type Cycle struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Start time.Time `json:"start"`
End *time.Time `json:"end"`
TimezoneOffset string `json:"timezone_offset"`
ScoreState ScoreState `json:"score_state"`
Score *CycleScore `json:"score"`
}
type CycleScore ¶
type CycleService ¶
type ListParams ¶
type Option ¶
type Option func(*clientConfig)
func WithAPIKey ¶
func WithLogger ¶
func WithProxyURL ¶
func WithSessionID ¶
func WithTimeout ¶
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Records []T `json:"records"` NextToken *string `json:"next_token,omitempty"` }
func (*PaginatedResponse[T]) HasMore ¶
func (p *PaginatedResponse[T]) HasMore() bool
type RateLimitInfo ¶
type RateLimitInfo struct {
Limit int // Requests allowed in current window
Remaining int // Requests remaining in current window
Reset time.Duration // Duration until the rate limit resets
}
RateLimitInfo contains parsed rate limit information from WHOOP API headers. See https://developer.whoop.com/docs/developing/rate-limiting/
func ParseRateLimitHeaders ¶
func ParseRateLimitHeaders(headers http.Header) (*RateLimitInfo, error)
type Recovery ¶
type Recovery struct {
CycleID int64 `json:"cycle_id"`
SleepID string `json:"sleep_id"`
UserID int64 `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ScoreState ScoreState `json:"score_state"`
Score *RecoveryScore `json:"score"`
}
type RecoveryScore ¶
type RecoveryScore struct {
UserCalibrating bool `json:"user_calibrating"`
RecoveryScore float64 `json:"recovery_score"`
RestingHeartRate float64 `json:"resting_heart_rate"`
HRVRmssdMilli float64 `json:"hrv_rmssd_milli"`
SpO2Percentage float64 `json:"spo2_percentage"`
SkinTempCelsius float64 `json:"skin_temp_celsius"`
}
type RecoveryService ¶
type RecoveryService interface {
List(ctx context.Context, params *ListParams) (*PaginatedResponse[Recovery], error)
}
type ScoreState ¶
type ScoreState string
const ( ScoreStateScored ScoreState = "SCORED" ScoreStatePendingScore ScoreState = "PENDING_SCORE" ScoreStateUnscorable ScoreState = "UNSCORABLE" )
type Sleep ¶
type Sleep struct {
ID string `json:"id"`
CycleID int64 `json:"cycle_id"`
V1ID *int64 `json:"v1_id"`
UserID int64 `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
TimezoneOffset string `json:"timezone_offset"`
Nap bool `json:"nap"`
ScoreState ScoreState `json:"score_state"`
Score *SleepScore `json:"score"`
}
type SleepNeeded ¶
type SleepScore ¶
type SleepScore struct {
StageSummary SleepStages `json:"stage_summary"`
SleepNeeded SleepNeeded `json:"sleep_needed"`
RespiratoryRate float64 `json:"respiratory_rate"`
SleepPerformancePercentage float64 `json:"sleep_performance_percentage"`
SleepConsistencyPercentage float64 `json:"sleep_consistency_percentage"`
SleepEfficiencyPercentage float64 `json:"sleep_efficiency_percentage"`
}
type SleepService ¶
type SleepStages ¶
type SleepStages struct {
TotalInBedTimeMilli int `json:"total_in_bed_time_milli"`
TotalAwakeTimeMilli int `json:"total_awake_time_milli"`
TotalNoDataTimeMilli int `json:"total_no_data_time_milli"`
TotalLightSleepTimeMilli int `json:"total_light_sleep_time_milli"`
TotalSlowWaveSleepTimeMilli int `json:"total_slow_wave_sleep_time_milli"`
TotalREMSleepTimeMilli int `json:"total_rem_sleep_time_milli"`
SleepCycleCount int `json:"sleep_cycle_count"`
DisturbanceCount int `json:"disturbance_count"`
}
type UserProfile ¶
type UserService ¶
type Workout ¶
type Workout struct {
ID string `json:"id"`
V1ID *int64 `json:"v1_id"`
UserID int64 `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
TimezoneOffset string `json:"timezone_offset"`
SportName string `json:"sport_name"`
ScoreState ScoreState `json:"score_state"`
Score *WorkoutScore `json:"score"`
}
type WorkoutScore ¶
type WorkoutScore struct {
Strain float64 `json:"strain"`
AverageHeartRate int `json:"average_heart_rate"`
MaxHeartRate int `json:"max_heart_rate"`
Kilojoule float64 `json:"kilojoule"`
PercentRecorded float64 `json:"percent_recorded"`
DistanceMeter *float64 `json:"distance_meter"`
AltitudeGainMeter *float64 `json:"altitude_gain_meter"`
AltitudeChangeMeter *float64 `json:"altitude_change_meter"`
ZoneDurations WorkoutZones `json:"zone_durations"`
}
type WorkoutService ¶
type WorkoutZones ¶
Click to show internal directories.
Click to hide internal directories.