strava

package
v0.0.0-...-a24ee6e Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CreateOauthConfig

func CreateOauthConfig(oauthConfigFile string) (*oauth2.Config, error)

Create the oauth config used for all oauth requests

func CreateStravaClient

func CreateStravaClient(sf *StravaFlags) (*strava3golang.APIClient, error)

func CreateToken

func CreateToken(tokenFile string) (*oauth2.Token, error)

func GetActivitiesAndStreams

func GetActivitiesAndStreams(config *ActivitiesConfig, filter ActivityFilter) (
	[]util.Jsonable, error)

note that this may return a partial result even when error is not nil

func InitLogging

func InitLogging(logFile string)

func RetrieveActivities

func RetrieveActivities(config *ActivitiesConfig) (
	[]strava3golang.SummaryActivity, error)

func RetrieveStreams

func RetrieveStreams(config *ActivitiesConfig, activityIds []int64) ([]*strava3golang.StreamSet, error)

retrieve the corresponding StreamSet for each activity in activityIds note that when an error is returned the returned stream may be partially complete

Types

type AbridgedSummaryActivity

type AbridgedSummaryActivity struct {
	// The unique identifier of the activity
	Id *int64 `json:"id,omitempty"`
	// The identifier provided at upload time
	ExternalId *string `json:"external_id,omitempty"`
	// The name of the activity
	Name *string `json:"name,omitempty"`
	// The activity's distance, in meters
	Distance *float32 `json:"distance,omitempty"`
	// The activity's moving time, in seconds
	MovingTime *int32 `json:"moving_time,omitempty"`
	// The activity's elapsed time, in seconds
	ElapsedTime *int32 `json:"elapsed_time,omitempty"`
	// The activity's average speed, in meters per second
	AverageSpeed *float32 `json:"average_speed,omitempty"`
	// Average power output in watts during this activity. Rides only
	AverageWatts *float32                    `json:"average_watts,omitempty"`
	Type         *strava3golang.ActivityType `json:"type,omitempty"`
}

intended to be used for logging activities.

func MapActivitiesToAbridged

func MapActivitiesToAbridged(
	activities []Activity) []AbridgedSummaryActivity

type ActivitiesConfig

type ActivitiesConfig struct {
	StravaClient              *strava3golang.APIClient
	StartTime                 time.Time
	EndTime                   time.Time
	GetStreamsConcurrency     int
	ActivitiesTimeoutDuration time.Duration
	StreamsTimeoutDuration    time.Duration
	ActivityIdsToIgnore       IntSet
	ActivitiesPerPage         int
	PreStreamSleep            time.Duration
}

type Activity

type Activity struct {
	// contains filtered or unexported fields
}

func (Activity) GetId

func (a Activity) GetId() int64

type ActivityAndStream

type ActivityAndStream struct {
	Activity  *strava3golang.SummaryActivity
	StreamSet *strava3golang.StreamSet
}

func (*ActivityAndStream) ToJson

func (aas *ActivityAndStream) ToJson() string

type ActivityFilter

type ActivityFilter func([]int64) ([]int64, error)

accepts a list of activity ids to consider. Returns the list of activity ids whose streams should be downloaded, or an error it is expected that the returned ids are in the same relative order as the inputs

type IntSet

type IntSet map[int64]struct{}

type StravaFlags

type StravaFlags struct {
	Config          ActivitiesConfig
	OauthConfigFile string
	OauthTokenFile  string
	// contains filtered or unexported fields
}

func (*StravaFlags) InitFlags

func (sf *StravaFlags) InitFlags(fs *flag.FlagSet) error

must be called before flag.Parse().

func (*StravaFlags) PostProcessFlags

func (sf *StravaFlags) PostProcessFlags(fs *flag.FlagSet) error

must be called after flag.Parse(). Panics on any error

type StreamKind

type StreamKind string
const (
	StreamTime           StreamKind = "time"
	StreamDistance       StreamKind = "distance"
	StreamLatlng         StreamKind = "latlng"
	StreamAltitude       StreamKind = "altitude"
	StreamVelicitySmooth StreamKind = "velocity_smooth"
	StreamHeartrate      StreamKind = "heartrate"
	StreamCadence        StreamKind = "cadence"
	StreamWatts          StreamKind = "watts"
	StreamTemp           StreamKind = "temp"
	StreamMoving         StreamKind = "moving"
	StreamGradeSmooth    StreamKind = "grade_smooth"
)

Jump to

Keyboard shortcuts

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