mirror of
https://github.com/sstent/go-garth.git
synced 2026-01-26 09:03:00 +00:00
feat(refactor): Implement 1A.1 Package Structure Refactoring
This commit implements the package structure refactoring as outlined in phase1.md (Task 1A.1). Key changes include: - Reorganized packages into `pkg/garmin` for public API and `internal/` for internal implementations. - Updated all import paths to reflect the new structure. - Consolidated types and client logic into their respective new packages. - Updated `cmd/garth/main.go` to use the new public API. - Fixed various compilation and test issues encountered during the refactoring process. - Converted `internal/api/client/auth_test.go` to a functional test. This establishes a solid foundation for future enhancements and improves maintainability.
This commit is contained in:
95
internal/users/settings.go
Normal file
95
internal/users/settings.go
Normal file
@@ -0,0 +1,95 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"garmin-connect/internal/api/client"
|
||||
)
|
||||
|
||||
type PowerFormat struct {
|
||||
FormatID int `json:"formatId"`
|
||||
FormatKey string `json:"formatKey"`
|
||||
MinFraction int `json:"minFraction"`
|
||||
MaxFraction int `json:"maxFraction"`
|
||||
GroupingUsed bool `json:"groupingUsed"`
|
||||
DisplayFormat *string `json:"displayFormat"`
|
||||
}
|
||||
|
||||
type FirstDayOfWeek struct {
|
||||
DayID int `json:"dayId"`
|
||||
DayName string `json:"dayName"`
|
||||
SortOrder int `json:"sortOrder"`
|
||||
IsPossibleFirstDay bool `json:"isPossibleFirstDay"`
|
||||
}
|
||||
|
||||
type WeatherLocation struct {
|
||||
UseFixedLocation *bool `json:"useFixedLocation"`
|
||||
Latitude *float64 `json:"latitude"`
|
||||
Longitude *float64 `json:"longitude"`
|
||||
LocationName *string `json:"locationName"`
|
||||
ISOCountryCode *string `json:"isoCountryCode"`
|
||||
PostalCode *string `json:"postalCode"`
|
||||
}
|
||||
|
||||
type UserData struct {
|
||||
Gender string `json:"gender"`
|
||||
Weight float64 `json:"weight"`
|
||||
Height float64 `json:"height"`
|
||||
TimeFormat string `json:"timeFormat"`
|
||||
BirthDate time.Time `json:"birthDate"`
|
||||
MeasurementSystem string `json:"measurementSystem"`
|
||||
ActivityLevel *string `json:"activityLevel"`
|
||||
Handedness string `json:"handedness"`
|
||||
PowerFormat PowerFormat `json:"powerFormat"`
|
||||
HeartRateFormat PowerFormat `json:"heartRateFormat"`
|
||||
FirstDayOfWeek FirstDayOfWeek `json:"firstDayOfWeek"`
|
||||
VO2MaxRunning *float64 `json:"vo2MaxRunning"`
|
||||
VO2MaxCycling *float64 `json:"vo2MaxCycling"`
|
||||
LactateThresholdSpeed *float64 `json:"lactateThresholdSpeed"`
|
||||
LactateThresholdHeartRate *float64 `json:"lactateThresholdHeartRate"`
|
||||
DiveNumber *int `json:"diveNumber"`
|
||||
IntensityMinutesCalcMethod string `json:"intensityMinutesCalcMethod"`
|
||||
ModerateIntensityMinutesHRZone int `json:"moderateIntensityMinutesHrZone"`
|
||||
VigorousIntensityMinutesHRZone int `json:"vigorousIntensityMinutesHrZone"`
|
||||
HydrationMeasurementUnit string `json:"hydrationMeasurementUnit"`
|
||||
HydrationContainers []map[string]interface{} `json:"hydrationContainers"`
|
||||
HydrationAutoGoalEnabled bool `json:"hydrationAutoGoalEnabled"`
|
||||
FirstbeatMaxStressScore *float64 `json:"firstbeatMaxStressScore"`
|
||||
FirstbeatCyclingLTTimestamp *int64 `json:"firstbeatCyclingLtTimestamp"`
|
||||
FirstbeatRunningLTTimestamp *int64 `json:"firstbeatRunningLtTimestamp"`
|
||||
ThresholdHeartRateAutoDetected bool `json:"thresholdHeartRateAutoDetected"`
|
||||
FTPAutoDetected *bool `json:"ftpAutoDetected"`
|
||||
TrainingStatusPausedDate *string `json:"trainingStatusPausedDate"`
|
||||
WeatherLocation *WeatherLocation `json:"weatherLocation"`
|
||||
GolfDistanceUnit *string `json:"golfDistanceUnit"`
|
||||
GolfElevationUnit *string `json:"golfElevationUnit"`
|
||||
GolfSpeedUnit *string `json:"golfSpeedUnit"`
|
||||
ExternalBottomTime *float64 `json:"externalBottomTime"`
|
||||
}
|
||||
|
||||
type UserSleep struct {
|
||||
SleepTime int `json:"sleepTime"`
|
||||
DefaultSleepTime bool `json:"defaultSleepTime"`
|
||||
WakeTime int `json:"wakeTime"`
|
||||
DefaultWakeTime bool `json:"defaultWakeTime"`
|
||||
}
|
||||
|
||||
type UserSleepWindow struct {
|
||||
SleepWindowFrequency string `json:"sleepWindowFrequency"`
|
||||
StartSleepTimeSecondsFromMidnight int `json:"startSleepTimeSecondsFromMidnight"`
|
||||
EndSleepTimeSecondsFromMidnight int `json:"endSleepTimeSecondsFromMidnight"`
|
||||
}
|
||||
|
||||
type UserSettings struct {
|
||||
ID int `json:"id"`
|
||||
UserData UserData `json:"userData"`
|
||||
UserSleep UserSleep `json:"userSleep"`
|
||||
ConnectDate *string `json:"connectDate"`
|
||||
SourceType *string `json:"sourceType"`
|
||||
UserSleepWindows []UserSleepWindow `json:"userSleepWindows,omitempty"`
|
||||
}
|
||||
|
||||
func GetSettings(c *client.Client) (*UserSettings, error) {
|
||||
// Implementation will be added in client.go
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user