fitstrava

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 15 Imported by: 0

README

fitstrava

Fitbit only syncs GPS-related workouts to Strava. This is a tool I manually run periodically to sync the other activities that my Fitbit recorded.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StravaCreateActivity

func StravaCreateActivity(strava StravaClient, activity StravaNewActivity) error

Types

type Athlete

type Athlete struct {
	ID                    int64         `json:"id"`
	Username              string        `json:"username"`
	ResourceState         int64         `json:"resource_state"`
	Firstname             string        `json:"firstname"`
	Lastname              string        `json:"lastname"`
	City                  string        `json:"city"`
	State                 string        `json:"state"`
	Country               string        `json:"country"`
	Sex                   string        `json:"sex"`
	Premium               bool          `json:"premium"`
	CreatedAt             string        `json:"created_at"`
	UpdatedAt             string        `json:"updated_at"`
	BadgeTypeID           int64         `json:"badge_type_id"`
	ProfileMedium         string        `json:"profile_medium"`
	Profile               string        `json:"profile"`
	Friend                interface{}   `json:"friend"`
	Follower              interface{}   `json:"follower"`
	FollowerCount         int64         `json:"follower_count"`
	FriendCount           int64         `json:"friend_count"`
	MutualFriendCount     int64         `json:"mutual_friend_count"`
	AthleteType           int64         `json:"athlete_type"`
	DatePreference        string        `json:"date_preference"`
	MeasurementPreference string        `json:"measurement_preference"`
	Clubs                 []interface{} `json:"clubs"`
	FTP                   interface{}   `json:"ftp"`
	Weight                float64       `json:"weight"`
	Bikes                 []Bike        `json:"bikes"`
	Shoes                 []Bike        `json:"shoes"`
}

type Bike

type Bike struct {
	ID            string `json:"id"`
	Primary       bool   `json:"primary"`
	Name          string `json:"name"`
	ResourceState int64  `json:"resource_state"`
	Distance      int64  `json:"distance"`
}

type FitbitActivity

type FitbitActivity struct {
	ActiveDuration        int64                       `json:"activeDuration"`
	ActivityLevel         []FitbitActivityLevel       `json:"activityLevel"`
	ActivityName          string                      `json:"activityName"`
	ActivityTypeID        int64                       `json:"activityTypeId"`
	Calories              int64                       `json:"calories"`
	CaloriesLink          string                      `json:"caloriesLink"`
	Duration              int64                       `json:"duration"`
	ElevationGain         float64                     `json:"elevationGain"`
	LastModified          string                      `json:"lastModified"`
	LogID                 int64                       `json:"logId"`
	LogType               string                      `json:"logType"`
	ManualValuesSpecified FitbitManualValuesSpecified `json:"manualValuesSpecified"`
	OriginalDuration      int64                       `json:"originalDuration"`
	OriginalStartTime     string                      `json:"originalStartTime"`
	StartTime             string                      `json:"startTime"`
	Steps                 int64                       `json:"steps"`
	TcxLink               string                      `json:"tcxLink"`
}

func FitbitGetActivities

func FitbitGetActivities(fitbit FitbitClient, after time.Time) ([]FitbitActivity, error)

func (FitbitActivity) ActivityTypeName

func (a FitbitActivity) ActivityTypeName(fitbit FitbitClient) string

type FitbitActivityLevel

type FitbitActivityLevel struct {
	Minutes int64  `json:"minutes"`
	Name    string `json:"name"`
}

type FitbitClient

type FitbitClient struct {
	Token fitbitAuthToken
	// contains filtered or unexported fields
}

func NewFitbitClient

func NewFitbitClient(clientID, clientSecret string) (FitbitClient, error)

type FitbitManualValuesSpecified

type FitbitManualValuesSpecified struct {
	Calories bool `json:"calories"`
	Distance bool `json:"distance"`
	Steps    bool `json:"steps"`
}

type Map

type Map struct {
	ID              string      `json:"id"`
	SummaryPolyline interface{} `json:"summary_polyline"`
	ResourceState   int64       `json:"resource_state"`
}

type Photos

type Photos struct {
	Primary interface{} `json:"primary"`
	Count   int64       `json:"count"`
}

type StatsVisibility

type StatsVisibility struct {
	Type       string `json:"type"`
	Visibility string `json:"visibility"`
}

type StravaActivity

type StravaActivity struct {
	ResourceState              int64             `json:"resource_state"`
	Athlete                    Athlete           `json:"athlete"`
	Name                       string            `json:"name"`
	Distance                   float64           `json:"distance"`
	MovingTime                 int64             `json:"moving_time"`
	ElapsedTime                int64             `json:"elapsed_time"`
	TotalElevationGain         float64           `json:"total_elevation_gain"`
	Type                       string            `json:"type"`
	WorkoutType                interface{}       `json:"workout_type,omitempty"`
	ID                         int64             `json:"id"`
	ExternalID                 string            `json:"external_id,omitempty"`
	UploadID                   int64             `json:"upload_id,omitempty"`
	StartDate                  string            `json:"start_date"`
	StartDateLocal             string            `json:"start_date_local"`
	Timezone                   string            `json:"timezone"`
	UTCOffset                  float64           `json:"utc_offset"`
	StartLatlng                interface{}       `json:"start_latlng"`
	EndLatlng                  interface{}       `json:"end_latlng"`
	LocationCity               interface{}       `json:"location_city"`
	LocationState              interface{}       `json:"location_state"`
	LocationCountry            string            `json:"location_country"`
	AchievementCount           int64             `json:"achievement_count"`
	KudosCount                 int64             `json:"kudos_count"`
	CommentCount               int64             `json:"comment_count"`
	AthleteCount               int64             `json:"athlete_count"`
	PhotoCount                 int64             `json:"photo_count"`
	Map                        Map               `json:"map"`
	Trainer                    bool              `json:"trainer"`
	Commute                    bool              `json:"commute"`
	Manual                     bool              `json:"manual"`
	Private                    bool              `json:"private"`
	Visibility                 string            `json:"visibility"`
	Flagged                    bool              `json:"flagged"`
	GearID                     interface{}       `json:"gear_id"`
	StartLatitude              interface{}       `json:"start_latitude"`
	StartLongitude             interface{}       `json:"start_longitude"`
	AverageSpeed               float64           `json:"average_speed"`
	MaxSpeed                   float64           `json:"max_speed"`
	AverageCadence             float64           `json:"average_cadence,omitempty"`
	AverageWatts               float64           `json:"average_watts,omitempty"`
	WeightedAverageWatts       int64             `json:"weighted_average_watts,omitempty"`
	Kilojoules                 float64           `json:"kilojoules,omitempty"`
	DeviceWatts                bool              `json:"device_watts,omitempty"`
	HasHeartrate               bool              `json:"has_heartrate"`
	AverageHeartrate           float64           `json:"average_heartrate,omitempty"`
	MaxHeartrate               float64           `json:"max_heartrate,omitempty"`
	MaxWatts                   int64             `json:"max_watts,omitempty"`
	HeartrateOptOut            bool              `json:"heartrate_opt_out"`
	DisplayHideHeartrateOption bool              `json:"display_hide_heartrate_option"`
	FromAcceptedTag            bool              `json:"from_accepted_tag"`
	PRCount                    int64             `json:"pr_count"`
	TotalPhotoCount            int64             `json:"total_photo_count"`
	HasKudoed                  bool              `json:"has_kudoed"`
	SufferScore                int64             `json:"suffer_score,omitempty"`
	Description                string            `json:"description"`
	Calories                   float64           `json:"calories"`
	PerceivedExertion          interface{}       `json:"perceived_exertion"`
	PreferPerceivedExertion    interface{}       `json:"prefer_perceived_exertion"`
	SegmentEfforts             []interface{}     `json:"segment_efforts"`
	Photos                     Photos            `json:"photos"`
	StatsVisibility            []StatsVisibility `json:"stats_visibility"`
	HideFromHome               bool              `json:"hide_from_home"`
	EmbedToken                 string            `json:"embed_token"`
	PrivateNote                interface{}       `json:"private_note"`
	AvailableZones             []interface{}     `json:"available_zones"`
}

func StravaGetActivities

func StravaGetActivities(strava StravaClient, after time.Time) ([]StravaActivity, error)

func StravaGetActivityByID

func StravaGetActivityByID(strava StravaClient, id int64) (StravaActivity, error)

type StravaClient

type StravaClient struct {
	Token stravaAuthToken
	// contains filtered or unexported fields
}

func NewStravaClient

func NewStravaClient(clientID, clientSecret string) (StravaClient, error)

type StravaNewActivity

type StravaNewActivity struct {
	Name, Type, Description string
	StartDate               time.Time
	ElapsedSeconds          int64
}

name required String, in form The name of the activity. type required String, in form Type of activity. For example - Run, Ride etc. start_date_local required Date, in form ISO 8601 formatted date time. elapsed_time required Integer, in form In seconds. description String, in form Description of the activity. distance Float, in form In meters.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL