Documentation ¶
Index ¶
- func Endpoint() oauth2.Endpoint
- type APIOption
- type Client
- type Datetime
- type Fault
- type Has
- type Metadata
- type Option
- func WithAutoRefresh(ctx context.Context) Option
- func WithBaseURL(baseURL string) Option
- func WithClientCredentials(clientID, clientSecret string) Option
- func WithConfig(config oauth2.Config) Option
- func WithHTTPClient(client *http.Client) Option
- func WithHTTPTracing(debug bool) Option
- func WithRateLimiter(r *rate.Limiter) Option
- func WithToken(token *oauth2.Token) Option
- func WithTokenCredentials(accessToken, refreshToken string, expiry time.Time) Option
- func WithTransport(t http.RoundTripper) Option
- type Ride
- type RideOptions
- type RidesService
- func (s *RidesService) Ride(ctx context.Context, rideID int64, opts ...APIOption) (*Ride, error)
- func (s *RidesService) Rides(ctx context.Context, userID UserID, spec activity.Pagination) ([]*Ride, error)
- func (s *RidesService) Status(ctx context.Context, uploadID int64) (*Upload, error)
- func (s *RidesService) StatusWithUser(ctx context.Context, userID UserID, uploadID int64) (*Upload, error)
- func (s *RidesService) StreamSets() map[string]string
- func (s *RidesService) Upload(ctx context.Context, file *activity.File) (*Upload, error)
- func (s *RidesService) UploadWithUser(ctx context.Context, userID UserID, file *activity.File) (*Upload, error)
- type Shift
- type Shifts
- type Streams
- type Summary
- type Upload
- type UploadResult
- type User
- type UserID
- type UserService
- type Zones
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIOption ¶ added in v0.6.0
APIOption for configuring API requests
func WithRideOptions ¶ added in v0.6.0
func WithRideOptions(r RideOptions) APIOption
type Client ¶
type Client struct { User *UserService Rides *RidesService // contains filtered or unexported fields }
Client for accessing Cycling Analytics' API
type Option ¶
Option provides a configuration mechanism for a Client
func WithAutoRefresh ¶
WithAutoRefresh refreshes access tokens automatically. The order of this option matters because it is dependent on the client's config and token. Use this option after With*Credentials.
func WithBaseURL ¶ added in v0.2.0
WithBaseURL specifies the base url
func WithClientCredentials ¶
WithAPICredentials provides the client api credentials for the application.
func WithConfig ¶
WithConfig sets the underlying oauth2.Config.
func WithHTTPClient ¶
WithHTTPClient sets the underlying http client.
func WithHTTPTracing ¶
WithHTTPTracing enables tracing http calls.
func WithRateLimiter ¶
WithRateLimiter rate limits the client's api calls
func WithTokenCredentials ¶
WithTokenCredentials provides the tokens for an authenticated user.
func WithTransport ¶
func WithTransport(t http.RoundTripper) Option
WithTransport sets the underlying http client transport.
type Ride ¶
type Ride struct { Format string `json:"format"` Has Has `json:"has"` ID int64 `json:"id"` LocalDatetime Datetime `json:"local_datetime"` Metadata Metadata `json:"metadata"` Notes string `json:"notes"` Purpose string `json:"purpose"` Streams Streams `json:"streams"` Subtype string `json:"subtype"` Summary Summary `json:"summary"` Title string `json:"title"` Trainer bool `json:"trainer"` UserID UserID `json:"user_id"` UTCDatetime Datetime `json:"utc_datetime"` }
type RideOptions ¶
type RideOptions struct { // Streams is a list of valid data streams Streams []string // Curves specifies the difference curves to return Curves struct { // AveragePower will be returned if true AveragePower bool // EffectivePower will be returned if true EffectivePower bool } }
RideOptions specify additional detail to return for a queried ride
type RidesService ¶
type RidesService service
RidesService manages rides for a user
func (*RidesService) Rides ¶
func (s *RidesService) Rides(ctx context.Context, userID UserID, spec activity.Pagination) ([]*Ride, error)
Rides returns a slice of rides for the user
func (*RidesService) StatusWithUser ¶
func (s *RidesService) StatusWithUser(ctx context.Context, userID UserID, uploadID int64) (*Upload, error)
Status returns the status of an upload request for the user
func (*RidesService) StreamSets ¶
func (s *RidesService) StreamSets() map[string]string
StreamSets returns the list of valid stream names
func (*RidesService) UploadWithUser ¶
func (s *RidesService) UploadWithUser(ctx context.Context, userID UserID, file *activity.File) (*Upload, error)
Upload the file for the user
type Streams ¶
type Streams struct { Power []float64 `json:"power,omitempty"` Speed []float64 `json:"speed,omitempty"` Distance []float64 `json:"distance,omitempty"` Heartrate []float64 `json:"heartrate,omitempty"` Cadence []float64 `json:"cadence,omitempty"` LRBalance []float64 `json:"lrbalance,omitempty"` Latitude []float64 `json:"latitude,omitempty"` Longitude []float64 `json:"longitude,omitempty"` Elevation []float64 `json:"elevation,omitempty"` Gradient []float64 `json:"gradient,omitempty"` Temperature []float64 `json:"temperature,omitempty"` TorqueEffectiveness []float64 `json:"torque_effectiveness,omitempty"` PedalSmoothness []float64 `json:"pedal_smoothness,omitempty"` PlatformCenterOffset []float64 `json:"platform_center_offset,omitempty"` PowerPhase []float64 `json:"power_phase,omitempty"` PowerDirection []float64 `json:"power_direction,omitempty"` THB []float64 `json:"thb,omitempty"` SMO2 []float64 `json:"smo2,omitempty"` RespirationRate []float64 `json:"respiration_rate,omitempty"` HeartRateVariability []float64 `json:"heart_rate_variability,omitempty"` Gears *Shifts `json:"gears,omitempty"` }
type Summary ¶
type Summary struct { AvgCadence float64 `json:"avg_cadence"` AvgHeartrate float64 `json:"avg_heartrate"` AvgPower float64 `json:"avg_power"` AvgSpeed float64 `json:"avg_speed"` AvgTemperature float64 `json:"avg_temperature"` Climbing float64 `json:"climbing"` Decoupling float64 `json:"decoupling"` Distance float64 `json:"distance"` Duration float64 `json:"duration"` Epower float64 `json:"epower"` Intensity float64 `json:"intensity"` Load float64 `json:"load"` LRBalance float64 `json:"lrbalance"` MaxCadence float64 `json:"max_cadence"` MaxHeartrate float64 `json:"max_heartrate"` MaxPower float64 `json:"max_power"` MaxSpeed float64 `json:"max_speed"` MaxTemperature float64 `json:"max_temperature"` MinTemperature float64 `json:"min_temperature"` MovingTime float64 `json:"moving_time"` PWC150 float64 `json:"pwc150"` // physical working capacity PWC170 float64 `json:"pwc170"` // physical working capacity PWCR2 float64 `json:"pwc_r2"` // physical working capacity RidingTime float64 `json:"riding_time"` TotalTime float64 `json:"total_time"` TRIMP float64 `json:"trimp"` Variability float64 `json:"variability"` Work float64 `json:"work"` Zones Zones `json:"zones"` }
type Upload ¶
type Upload struct { ID int64 `json:"upload_id"` Status string `json:"status"` RideID int64 `json:"ride_id"` UserID UserID `json:"user_id"` Format string `json:"format"` Datetime Datetime `json:"datetime"` Filename string `json:"filename"` Size int64 `json:"size"` Error string `json:"error"` ErrorCode string `json:"error_code"` }
func (*Upload) Identifier ¶
type UploadResult ¶
type UserID ¶
type UserID int
const ( // Me represents the user id of the authenticated user Me UserID = 0 )