Documentation ¶
Overview ¶
Package types contains all the types that represent a response given by the Fitbit API.
Index ¶
- type APIError
- type ActiveZoneMinutes
- type ActivitiesSummary
- type ActivityCaloriesSeries
- type ActivityCatalog
- type ActivityDescription
- type ActivityLevel
- type ActivityLog
- type ActivityLogList
- type AuthorizedUser
- type AuthorizingUser
- type BMISeries
- type BestStatsSource
- type BodyFatLog
- type BodyFatSeries
- type BodyWeightLog
- type BodyWeightSeries
- type BreathingRate
- type BreathingRateIntraday
- type BreathingRateIntradaySummary
- type BreathingRateTimePoint
- type BreathingRateTimePointIntraday
- type BreathingRateValue
- type CaloriesBMRSeries
- type CaloriesSeries
- type CaloriesSeriesIntraday
- type CardioFitnessScore
- type CardioScoreTimePoint
- type CardioScoreValue
- type Category
- type CoreTemperature
- type CoreTemperatureTimePoint
- type DailyActivitySummary
- type Dataset
- type Distance
- type DistanceSeries
- type DistanceSeriesIntraday
- type ElevationSeries
- type ElevationSeriesIntraday
- type FatGoal
- type FavoriteActivities
- type FavoriteActivity
- type FitbitDate
- type FitbitDateTime
- type FitbitTime
- type FloorsSeries
- type FloorsSeriesIntraday
- type FrequentActivities
- type Goal
- type HeartRateActivities
- type HeartRateIntraday
- type HeartRateSeries
- type HeartRateTimePointValue
- type HeartRateVariability
- type HeartRateVariabilityIntraday
- type HeartRateVariabilityMinute
- type HeartRateVariabilityTimeStep
- type HeartRateVariabilityTimeStepIntraday
- type HeartRateVariabilityValue
- type HeartRateVariabilityValueIntraday
- type HeartRateZone
- type LifeTimeActivities
- type LifeTimeStats
- type LifeTimeTimeStep
- type LifetimeStatsSource
- type LogSource
- type LoggedActivityLevel
- type ManualValuesSpecified
- type MinimalActivity
- type MinutesFairlyActiveSeries
- type MinutesInHeartRateZone
- type MinutesLightlyActiveSeries
- type MinutesSedentarySeries
- type MinutesVeryActiveSeries
- type OAuth2Error
- type OxygenSaturation
- type OxygenSaturationIntraday
- type OxygenSaturationMinute
- type OxygenSaturationValue
- type OxygenSaturations
- type Pagination
- type Period
- type RecentActivities
- type SingleActivity
- type SkinTemperature
- type SkinTemperatureTimePoint
- type SkinTemperatureValue
- type SleepConsistency
- type SleepData
- type SleepGoal
- type SleepGoalReport
- type SleepLevel
- type SleepLog
- type SleepLogs
- type SleepStageDetail
- type SleepStages
- type SleepStagesSummary
- type SleepSummary
- type StepsSeries
- type StepsSeriesIntraday
- type SubCategory
- type TimeSeriesIntraday
- type TimeStep
- type UserFatGoal
- type UserFatLog
- type UserGoal
- type UserLifeTimeStats
- type UserWeightGoal
- type UserWeightLog
- type WeightGoal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { ErrorType string `json:"errorType"` FieldName string `json:"fieldName,omitempty"` Message string `json:"message"` }
APIError represents the message sent by the Fitbit API when there's an error (in the request, or on the server).
type ActiveZoneMinutes ¶
type ActiveZoneMinutes struct { MinutesInHeartRateZones []MinutesInHeartRateZone `json:"minutesInHeartRateZones"` TotalMinutes int64 `json:"totalMinutes"` }
type ActivitiesSummary ¶
type ActivitiesSummary struct { ActiveScore int64 `json:"activeScore"` ActivityCalories int64 `json:"activityCalories"` CaloriesBMR int64 `json:"caloriesBMR"` CaloriesOut int64 `json:"caloriesOut"` Distances []Distance `json:"distances"` FairlyActiveMinutes int64 `json:"fairlyActiveMinutes"` HeartRateZones []HeartRateZone `json:"heartRateZones"` LightlyActiveMinutes int64 `json:"lightlyActiveMinutes"` MarginalCalories int64 `json:"marginalCalories"` RestingHeartRate int64 `json:"restingHeartRate"` SedentaryMinutes int64 `json:"sedentaryMinutes"` Steps int64 `json:"steps"` VeryActiveMinutes int64 `json:"veryActiveMinutes"` }
type ActivityCaloriesSeries ¶
type ActivityCaloriesSeries struct {
TimeSeries []TimeStep `json:"activities-activityCalories"`
}
type ActivityCatalog ¶
type ActivityCatalog struct {
Categories []Category `json:"categories"`
}
type ActivityDescription ¶
type ActivityLevel ¶
type ActivityLog ¶
type ActivityLog struct { ActiveDuration int64 `json:"activeDuration"` ActiveZoneMinutes ActiveZoneMinutes `json:"activeZoneMinutes"` ActivityLevel []LoggedActivityLevel `json:"activityLevel"` ActivityName string `json:"activityName"` ActivityTypeID int64 `json:"activityTypeId"` AverageHeartRate int64 `json:"averageHeartRate"` Calories int64 `json:"calories"` Distance float64 `json:"distance"` DistanceUnit string `json:"distanceUnit"` Duration int64 `json:"duration"` ElevationGain int64 `json:"elevationGain"` HasActiveZoneMinutes bool `json:"hasActiveZoneMinutes"` HeartRateLink string `json:"heartRateLink"` HeartRateZones []HeartRateZone `json:"heartRateZones"` LastModified string `json:"lastModified"` LogID int64 `json:"logId"` LogType string `json:"logType"` ManualValuesSpecified ManualValuesSpecified `json:"manualValuesSpecified"` OriginalDuration int64 `json:"originalDuration"` OriginalStartTime FitbitDateTime `json:"originalStartTime"` Pace float64 `json:"pace"` Source *LogSource `json:"source"` Speed float64 `json:"speed"` StartTime FitbitDateTime `json:"startTime"` Steps int64 `json:"steps"` TcxLink string `json:"tcxLink"` }
type ActivityLogList ¶
type ActivityLogList struct { Activities []ActivityLog `json:"activities"` Pagination Pagination `json:"pagination"` }
type AuthorizedUser ¶
type AuthorizedUser struct { AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` RefreshToken string `json:"refresh_token"` Scope string `json:"scope"` TokenType string `json:"token_type"` UserID string `json:"user_id"` }
AuthorizedUser represents the payload received after succesfully exchaing the Authorization Code with the Fitbit OAuth2 server (Server Application Type) See the documentation - step 4.
type AuthorizingUser ¶
AuthorizingUser is the type used during the exchange of the "Code" for the tokens in the OAuth2 flow. There's no JSON decoration because the code is taken from the URL. The same goes for the CSRFToken that's placed inside the "state" URL parameter.
type BestStatsSource ¶
type BestStatsSource struct { Total LifeTimeActivities `json:"total"` Tracker LifeTimeActivities `json:"tracker"` }
type BodyFatLog ¶
type BodyFatLog struct {
Fat []UserFatLog `json:"fat"`
}
type BodyFatSeries ¶
type BodyFatSeries struct {
TimeSeries []TimeStep `json:"body-fat"`
}
type BodyWeightLog ¶
type BodyWeightLog struct {
Weight []UserWeightLog `json:"weight"`
}
type BodyWeightSeries ¶
type BodyWeightSeries struct {
TimeSeries []TimeStep `json:"body-weight"`
}
type BreathingRate ¶
type BreathingRate struct {
Br []BreathingRateTimePoint `json:"br"`
}
type BreathingRateIntraday ¶
type BreathingRateIntraday struct {
Br []BreathingRateTimePointIntraday `json:"br"`
}
type BreathingRateIntradaySummary ¶
type BreathingRateIntradaySummary struct { DeepSleepSummary BreathingRateValue `json:"deepSleepSummary"` FullSleepSummary BreathingRateValue `json:"fullSleepSummary"` LightSleepSummary BreathingRateValue `json:"lightSleepSummary"` RemSleepSummary BreathingRateValue `json:"remSleepSummary"` }
type BreathingRateTimePoint ¶
type BreathingRateTimePoint struct { DateTime FitbitDateTime `json:"dateTime"` Value BreathingRateValue `json:"value"` }
type BreathingRateTimePointIntraday ¶
type BreathingRateTimePointIntraday struct { DateTime FitbitDate `json:"dateTime"` Value BreathingRateIntradaySummary `json:"value"` }
type BreathingRateValue ¶
type BreathingRateValue struct {
BreathingRate float64 `json:"breathingRate"`
}
type CaloriesBMRSeries ¶
type CaloriesBMRSeries struct {
TimeSeries []TimeStep `json:"activities-caloriesBMR"`
}
type CaloriesSeries ¶
type CaloriesSeries struct {
TimeSeries []TimeStep `json:"activities-calories"`
}
type CaloriesSeriesIntraday ¶
type CaloriesSeriesIntraday struct { CaloriesSeries CaloriesIntraday TimeSeriesIntraday `json:"activities-calories-intraday"` }
type CardioFitnessScore ¶
type CardioFitnessScore struct {
CardioScore []CardioScoreTimePoint `json:"cardioScore"`
}
type CardioScoreTimePoint ¶
type CardioScoreTimePoint struct { DateTime FitbitDate `json:"dateTime"` Value CardioScoreValue `json:"value"` }
type CardioScoreValue ¶
type CardioScoreValue struct {
Vo2Max string `json:"vo2Max"`
}
type Category ¶
type Category struct { Activities []ActivityDescription `json:"activities"` ID int64 `json:"id"` Name string `json:"name"` SubCategories []SubCategory `json:"subCategories"` }
type CoreTemperature ¶
type CoreTemperature struct {
TempCore []CoreTemperatureTimePoint `json:"tempCore"`
}
type CoreTemperatureTimePoint ¶
type CoreTemperatureTimePoint struct { DateTime FitbitDate `json:"dateTime"` Value float64 `json:"value"` }
type DailyActivitySummary ¶
type DailyActivitySummary struct { Activities []ActivitiesSummary `json:"activities"` Goals Goal `json:"goals"` Summary ActivitiesSummary `json:"summary"` }
type Dataset ¶
type Dataset struct { Level int64 `json:"level,omitempty"` Mets int64 `json:"mets,omitempty"` Time FitbitTime `json:"time"` Value float64 `json:"value"` }
type DistanceSeries ¶
type DistanceSeries struct {
TimeSeries []TimeStep `json:"activities-distance"`
}
type DistanceSeriesIntraday ¶
type DistanceSeriesIntraday struct { DistanceSeries DistanceIntraday TimeSeriesIntraday `json:"activities-distance-intraday"` }
type ElevationSeries ¶
type ElevationSeries struct {
TimeSeries []TimeStep `json:"activities-elevation"`
}
type ElevationSeriesIntraday ¶
type ElevationSeriesIntraday struct { ElevationSeries ElevationIntraday TimeSeriesIntraday `json:"activities-elevation-intraday"` }
type FavoriteActivity ¶
type FitbitDate ¶
Custom type for the Date (without Time) fields returned by the Fitbit API
func (*FitbitDate) MarshalJSON ¶
func (d *FitbitDate) MarshalJSON() ([]byte, error)
func (*FitbitDate) UnmarshalJSON ¶
func (d *FitbitDate) UnmarshalJSON(b []byte) (err error)
type FitbitDateTime ¶
Custom type for the DateTime fields returned by the Fitbit API
func (*FitbitDateTime) MarshalJSON ¶
func (d *FitbitDateTime) MarshalJSON() ([]byte, error)
func (*FitbitDateTime) UnmarshalJSON ¶
func (d *FitbitDateTime) UnmarshalJSON(b []byte) (err error)
type FitbitTime ¶
Custom type for the Time (without Date) fields returned by the Fitbit API
func (*FitbitTime) MarshalJSON ¶
func (d *FitbitTime) MarshalJSON() ([]byte, error)
func (*FitbitTime) UnmarshalJSON ¶
func (d *FitbitTime) UnmarshalJSON(b []byte) (err error)
type FloorsSeries ¶
type FloorsSeries struct {
TimeSeries []TimeStep `json:"activities-floors"`
}
type FloorsSeriesIntraday ¶
type FloorsSeriesIntraday struct { FloorsSeries FloorsIntraday TimeSeriesIntraday `json:"activities-floors-intraday"` }
type HeartRateActivities ¶
type HeartRateActivities struct { DateTime FitbitDate `json:"dateTime"` Value HeartRateTimePointValue `json:"value"` }
type HeartRateIntraday ¶
type HeartRateIntraday struct { HeartRateSeries HeartRateIntraday TimeSeriesIntraday `json:"activities-heart-intraday"` }
type HeartRateSeries ¶
type HeartRateSeries struct {
ActivitiesHeart []HeartRateActivities `json:"activities-heart"`
}
type HeartRateTimePointValue ¶
type HeartRateTimePointValue struct { CustomHeartRateZones []HeartRateZone `json:"customHeartRateZones"` HeartRateZones []HeartRateZone `json:"heartRateZones"` RestingHeartRate int64 `json:"restingHeartRate"` }
type HeartRateVariability ¶
type HeartRateVariability struct {
Hrv []HeartRateVariabilityTimeStep `json:"hrv"`
}
type HeartRateVariabilityIntraday ¶
type HeartRateVariabilityIntraday struct {
Hrv []HeartRateVariabilityTimeStepIntraday `json:"hrv"`
}
type HeartRateVariabilityMinute ¶
type HeartRateVariabilityMinute struct { Minute FitbitDate `json:"minute"` Value HeartRateVariabilityValueIntraday `json:"value"` }
type HeartRateVariabilityTimeStep ¶
type HeartRateVariabilityTimeStep struct { DateTime FitbitDate `json:"dateTime"` Value HeartRateVariabilityValue `json:"value"` }
type HeartRateVariabilityTimeStepIntraday ¶
type HeartRateVariabilityTimeStepIntraday struct { DateTime FitbitDate `json:"dateTime"` Minutes []HeartRateVariabilityMinute `json:"minutes"` }
type HeartRateZone ¶
type LifeTimeActivities ¶
type LifeTimeActivities struct { Distance LifeTimeTimeStep `json:"distance"` Steps LifeTimeTimeStep `json:"steps"` Floors LifeTimeTimeStep `json:"floors"` }
type LifeTimeStats ¶
type LifeTimeTimeStep ¶
type LifeTimeTimeStep struct { Date FitbitDate `json:"date"` Value float64 `json:"value"` }
type LifetimeStatsSource ¶
type LifetimeStatsSource struct { Total LifeTimeStats `json:"total"` Tracker LifeTimeStats `json:"tracker"` }
type LoggedActivityLevel ¶
type ManualValuesSpecified ¶
type MinimalActivity ¶
type MinutesFairlyActiveSeries ¶
type MinutesFairlyActiveSeries struct {
TimeSeries []TimeStep `json:"activities-minutesFairlyActive"`
}
type MinutesInHeartRateZone ¶
type MinutesLightlyActiveSeries ¶
type MinutesLightlyActiveSeries struct {
TimeSeries []TimeStep `json:"activities-minutesLightlyActive"`
}
type MinutesSedentarySeries ¶
type MinutesSedentarySeries struct {
TimeSeries []TimeStep `json:"activities-minutesSedentary"`
}
type MinutesVeryActiveSeries ¶
type MinutesVeryActiveSeries struct {
TimeSeries []TimeStep `json:"activities-minutesVeryActive"`
}
type OAuth2Error ¶
OAuth2Error represents the payload received in case of error, during the OAuth2 authorization flow
type OxygenSaturation ¶
type OxygenSaturation struct { DateTime FitbitDate `json:"dateTime"` Value OxygenSaturationValue `json:"value"` }
type OxygenSaturationIntraday ¶
type OxygenSaturationIntraday struct { DateTime FitbitDate `json:"dateTime"` Minutes []OxygenSaturationMinute `json:"minutes"` }
type OxygenSaturationMinute ¶
type OxygenSaturationMinute struct { Minute FitbitDateTime `json:"minute"` Value float64 `json:"value"` }
type OxygenSaturationValue ¶
type OxygenSaturations ¶
type OxygenSaturations []OxygenSaturation
type Pagination ¶
type Pagination struct { AfterDate FitbitDateTime `json:"afterDate,omitempty"` BeforeDate FitbitDateTime `json:"beforeDate,omitempty"` Limit int64 `json:"limit"` Next string `json:"next"` Offset int64 `json:"offset"` Previous string `json:"previous"` Sort string `json:"sort"` }
type Period ¶
type Period string
const ( DateTimeLayout = "2006-01-02T15:04" DateLayout = "2006-01-02" TimeLayout = "15:04" // 1d | 7d | 30d | 1w | 1m | 3m | 6m | 1y Period1Day Period = "1d" Period7Days Period = "7d" Period30Days Period = "30d" Period1Week Period = "1w" Period1Month Period = "1m" Period3Months Period = "3m" Period6Months Period = "6m" Period1Year Period = "1y" )
type SingleActivity ¶
type SingleActivity struct {
Activity ActivityDescription `json:"activity"`
}
type SkinTemperature ¶
type SkinTemperature struct {
TempSkin []SkinTemperatureTimePoint `json:"tempSkin"`
}
type SkinTemperatureTimePoint ¶
type SkinTemperatureTimePoint struct { DateTime FitbitDate `json:"dateTime"` LogType string `json:"logType"` Value SkinTemperatureValue `json:"value"` }
type SkinTemperatureValue ¶
type SkinTemperatureValue struct {
NightlyRelative float64 `json:"nightlyRelative"`
}
type SleepConsistency ¶
type SleepData ¶
type SleepData struct { DateTime FitbitDateTime `json:"dateTime"` Level string `json:"level"` Seconds int64 `json:"seconds"` }
type SleepGoal ¶
type SleepGoal struct { Bedtime string `json:"bedtime"` MinDuration int64 `json:"minDuration"` UpdatedOn FitbitDateTime `json:"updatedOn"` WakeupTime string `json:"wakeupTime"` }
type SleepGoalReport ¶
type SleepGoalReport struct { Consistency SleepConsistency `json:"consistency"` Goal SleepGoal `json:"goal"` }
type SleepLevel ¶
type SleepLevel struct { Data []SleepData `json:"data"` ShortData []SleepData `json:"shortData"` Summary SleepStages `json:"summary"` }
type SleepLog ¶
type SleepLog struct { DateOfSleep FitbitDate `json:"dateOfSleep"` Duration int64 `json:"duration"` Efficiency int64 `json:"efficiency"` EndTime FitbitDateTime `json:"endTime"` InfoCode int64 `json:"infoCode"` IsMainSleep bool `json:"isMainSleep"` Levels SleepLevel `json:"levels"` LogID int64 `json:"logId"` LogType string `json:"logType"` MinutesAfterWakeup int64 `json:"minutesAfterWakeup"` MinutesAsleep int64 `json:"minutesAsleep"` MinutesAwake int64 `json:"minutesAwake"` MinutesToFallAsleep int64 `json:"minutesToFallAsleep"` StartTime FitbitDateTime `json:"startTime"` TimeInBed int64 `json:"timeInBed"` Type string `json:"type"` }
type SleepLogs ¶
type SleepLogs struct { Sleep []SleepLog `json:"sleep"` Summary SleepSummary `json:"summary,omitempty"` Pagination Pagination `json:"pagination"` }
/sleep/date/%s.json /sleep/date/%s/%s.json /sleep/list.json?afterDate=2022-10-31&sort=asc&offset=0&limit=2
type SleepStageDetail ¶
type SleepStages ¶
type SleepStages struct { Deep SleepStageDetail `json:"deep"` Light SleepStageDetail `json:"light"` Rem SleepStageDetail `json:"rem"` Wake SleepStageDetail `json:"wake"` }
type SleepStagesSummary ¶
type SleepSummary ¶
type SleepSummary struct { Stages SleepStagesSummary `json:"stages"` TotalMinutesAsleep int64 `json:"totalMinutesAsleep"` TotalSleepRecords int64 `json:"totalSleepRecords"` TotalTimeInBed int64 `json:"totalTimeInBed"` }
type StepsSeries ¶
type StepsSeries struct {
TimeSeries []TimeStep `json:"activities-steps"`
}
type StepsSeriesIntraday ¶
type StepsSeriesIntraday struct { StepsSeries StepsIntraday TimeSeriesIntraday `json:"activities-steps-intraday"` }
type SubCategory ¶
type SubCategory struct { Activities []ActivityDescription `json:"activities"` ID int64 `json:"id"` Name string `json:"name"` }
type TimeSeriesIntraday ¶
type TimeStep ¶
type TimeStep struct { // Field with name DateTime, but it's just a date DateTime FitbitDate `json:"dateTime"` Value string `json:"value"` }
type UserFatGoal ¶
type UserFatGoal struct {
Goal FatGoal `json:"goal"`
}
type UserFatLog ¶
type UserFatLog struct { Date FitbitDate `json:"date"` Fat int64 `json:"fat"` LogID int64 `json:"logId"` Source string `json:"source"` Time FitbitTime `json:"time"` }
type UserLifeTimeStats ¶
type UserLifeTimeStats struct { Best BestStatsSource `json:"best"` Lifetime LifetimeStatsSource `json:"lifetime"` }
type UserWeightGoal ¶
type UserWeightGoal struct {
Goal WeightGoal `json:"goal"`
}
type UserWeightLog ¶
type UserWeightLog struct { BMI float64 `json:"bmi"` Date FitbitDate `json:"date"` Fat int64 `json:"fat"` LogID int64 `json:"logId"` Source string `json:"source"` Time FitbitTime `json:"time"` Weight float64 `json:"weight"` }
type WeightGoal ¶
type WeightGoal struct { GoalType string `json:"goalType"` StartDate FitbitDate `json:"startDate"` StartWeight int64 `json:"startWeight"` Weight int64 `json:"weight"` WeightThreshold float64 `json:"weightThreshold"` }