Documentation ¶
Index ¶
Constants ¶
View Source
const DateLayout = "2006-01-02 15:04:05 -0700"
View Source
const MetricTypeMinMaxAvg = "MINMAXAVG"
View Source
const MetricTypeQty = "QTY"
View Source
const MetricTypeSleep = "SLEEP"
View Source
const MetricTypeUnknown = "UNKNOWN"
Variables ¶
View Source
var LogUnknownMetrics = false
Functions ¶
func LookupMetricType ¶
Types ¶
type APIExportRequest ¶
type APIExportRequest struct { Metrics []Metric `json:"metrics"` Workouts []Workout `json:"workouts"` // contains filtered or unexported fields }
func Parse ¶
func Parse(b []byte) (*APIExportRequest, error)
func (*APIExportRequest) PopulatedMetrics ¶
func (req *APIExportRequest) PopulatedMetrics() []Metric
PopulatedMetrics returns only the metrics which have > 0 samples.
func (*APIExportRequest) TotalSamples ¶
func (req *APIExportRequest) TotalSamples() int
TotalSamples returns the total number of samples across all metrics
type HeartRateLog ¶
type MinMaxAvgSample ¶
type MinMaxAvgSample struct { Date *Timestamp `json:"date"` Max float64 `json:"max"` Min float64 `json:"min"` Avg float64 `json:"avg"` }
func (*MinMaxAvgSample) GetTimestamp ¶
func (s *MinMaxAvgSample) GetTimestamp() *Timestamp
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) Parse ¶
func (p *Parser) Parse() (*APIExportRequest, error)
type QtySample ¶
func (*QtySample) GetTimestamp ¶
type Sample ¶
type Sample interface {
GetTimestamp() *Timestamp
}
func ParseSamples ¶
func ParseSamples(metricName string, rawSamples []json.RawMessage) ([]Sample, error)
type SleepSample ¶
type SleepSample struct { Date *Timestamp `json:"date"` Asleep float64 `json:"asleep"` InBed float64 `json:"inBed"` SleepSource string `json:"sleepSource"` InBedSource string `json:"inBedSource"` }
func (*SleepSample) GetTimestamp ¶
func (s *SleepSample) GetTimestamp() *Timestamp
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
func (*Timestamp) MarshalJSON ¶
func (*Timestamp) UnmarshalJSON ¶
type Workout ¶
type Workout struct { Name string `json:"name"` Start *Timestamp `json:"start"` End *Timestamp `json:"end"` TotalEnergy QtyUnit `json:"totalEnergy"` ActiveEnergy QtyUnit `json:"activeEnergy"` AvgHeartRate QtyUnit `json:"avgHeartRate"` StepCadence QtyUnit `json:"stepCadence"` Speed QtyUnit `json:"speed"` SwimCadence QtyUnit `json:"swimCadence"` Intensity QtyUnit `json:"intensity"` Humidity QtyUnit `json:"humidity"` TotalSwimmingStrokeCount QtyUnit `json:"totalSwimmingStrokeCount"` FlightsClimbed QtyUnit `json:"flightsClimbed"` MaxHeartRate QtyUnit `json:"maxHeartRate"` Distance QtyUnit `json:"distance"` StepCount QtyUnit `json:"stepCount"` Temperature QtyUnit `json:"temperature"` Elevation Elevation `json:"elevation"` Route []GPSLog `json:"route"` HeartRateData []HeartRateLog `json:"heartRateData"` HeartRateRecovery []HeartRateLog `json:"heartRateRecovery"` }
Click to show internal directories.
Click to hide internal directories.