Documentation
¶
Index ¶
- Constants
- func Endpoint() oauth2.Endpoint
- type Activity
- type ActivityService
- func (s *ActivityService) Activities(ctx context.Context, athleteID int64, spec activity.Pagination) ([]*Activity, error)
- func (s *ActivityService) Activity(ctx context.Context, athleteID int64, activityID int64) (*Activity, error)
- func (s *ActivityService) Export(ctx context.Context, activityID int64) (*activity.Export, error)
- func (s *ActivityService) ExportActivity(ctx context.Context, act *Activity) (*activity.Export, error)
- type AuthService
- type Client
- type Datetime
- type Fault
- 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 WithTokenRefresh(username, password string) Option
- func WithTransport(t http.RoundTripper) Option
- type Privacy
- type Profile
- type ProfileService
- type SocialFacts
Constants ¶
const Me = "me"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity struct { IDString string `json:"id_str"` ID int64 `json:"id"` ProfileID int64 `json:"profileId"` Profile *Profile `json:"profile"` WorldID int64 `json:"worldId"` Name string `json:"name"` Description string `json:"description"` PrivateActivity bool `json:"privateActivity"` Sport string `json:"sport"` StartDate Datetime `json:"startDate"` EndDate Datetime `json:"endDate"` LastSaveDate string `json:"lastSaveDate"` AutoClosed bool `json:"autoClosed"` Duration string `json:"duration"` DistanceInMeters float64 `json:"distanceInMeters"` FitFileBucket string `json:"fitFileBucket"` FitFileKey string `json:"fitFileKey"` TotalElevation float64 `json:"totalElevation"` AvgWatts float64 `json:"avgWatts"` RideOnGiven bool `json:"rideOnGiven"` ActivityRideOnCount int `json:"activityRideOnCount"` ActivityCommentCount int `json:"activityCommentCount"` Calories float64 `json:"calories"` PrimaryImageURL string `json:"primaryImageUrl"` MovingTimeInMillis int `json:"movingTimeInMs"` Privacy string `json:"privacy"` }
type ActivityService ¶
type ActivityService service
ActivityService is the API for profile endpoints
func (*ActivityService) Activities ¶
func (s *ActivityService) Activities( ctx context.Context, athleteID int64, spec activity.Pagination) ([]*Activity, error)
Activities returns a slice of activities for the user
func (*ActivityService) Activity ¶
func (s *ActivityService) Activity(ctx context.Context, athleteID int64, activityID int64) (*Activity, error)
Activity returns the activity for the athlete and activity id
func (*ActivityService) ExportActivity ¶
func (s *ActivityService) ExportActivity(ctx context.Context, act *Activity) (*activity.Export, error)
ExportActivity exports the data file for the activity
type Client ¶
type Client struct { Auth *AuthService Activity *ActivityService Profile *ProfileService // contains filtered or unexported fields }
Client for communicating with Zwift
type Option ¶
Option provides a configuration mechanism for a Client
func WithAutoRefresh ¶ added in v0.3.2
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 ¶ added in v0.3.2
WithAPICredentials provides the client api credentials for the application.
func WithConfig ¶ added in v0.3.2
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 WithTokenRefresh ¶ added in v0.4.0
WithTokenRefresh refreshes the access token if none is provided
func WithTransport ¶
func WithTransport(t http.RoundTripper) Option
WithTransport sets the underlying http client transport.
type Privacy ¶
type Privacy struct { ApprovalRequired bool `json:"approvalRequired"` DisplayWeight bool `json:"displayWeight"` Minor bool `json:"minor"` PrivateMessaging bool `json:"privateMessaging"` DefaultFitnessDataPrivacy bool `json:"defaultFitnessDataPrivacy"` SuppressFollowerNotification bool `json:"suppressFollowerNotification"` DisplayAge bool `json:"displayAge"` DefaultActivityPrivacy string `json:"defaultActivityPrivacy"` }
type Profile ¶
type Profile struct { ID int64 `json:"id"` PublicID string `json:"publicId"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Male bool `json:"male"` ImageSrc string `json:"imageSrc"` ImageSrcLarge string `json:"imageSrcLarge"` PlayerType string `json:"playerType"` CountryAlpha3 string `json:"countryAlpha3"` CountryCode int `json:"countryCode"` UseMetric bool `json:"useMetric"` Riding bool `json:"riding"` Privacy *Privacy `json:"privacy"` SocialFacts *SocialFacts `json:"socialFacts"` WorldID int64 `json:"worldId"` EnrolledZwiftAcademy bool `json:"enrolledZwiftAcademy"` PlayerTypeID int64 `json:"playerTypeId"` PlayerSubTypeID int64 `json:"playerSubTypeId"` CurrentActivityID int64 `json:"currentActivityId"` Address string `json:"address"` Age int `json:"age"` BodyType int `json:"bodyType"` ConnectedToStrava bool `json:"connectedToStrava"` ConnectedToTrainingPeaks bool `json:"connectedToTrainingPeaks"` ConnectedToTodaysPlan bool `json:"connectedToTodaysPlan"` ConnectedToUnderArmour bool `json:"connectedToUnderArmour"` ConnectedToWithings bool `json:"connectedToWithings"` ConnectedToFitbit bool `json:"connectedToFitbit"` ConnectedToGarmin bool `json:"connectedToGarmin"` ConnectedToRuntastic bool `json:"connectedToRuntastic"` ConnectedToZwiftPower bool `json:"connectedToZwiftPower"` StravaPremium bool `json:"stravaPremium"` Bt string `json:"bt"` BirthDate string `json:"dob"` EmailAddress string `json:"emailAddress"` Height int `json:"height"` Location string `json:"location"` PreferredLanguage string `json:"preferredLanguage"` MixpanelDistinctID string `json:"mixpanelDistinctId"` ProfileChanges bool `json:"profileChanges"` Weight int `json:"weight"` B bool `json:"b"` CreatedOn string `json:"createdOn"` Source string `json:"source"` Origin string `json:"origin"` LaunchedGameClient string `json:"launchedGameClient"` FTP int `json:"ftp"` UserAgent string `json:"userAgent"` RunTime1MiInSeconds int `json:"runTime1miInSeconds"` RunTime5KmInSeconds int `json:"runTime5kmInSeconds"` RunTime10KmInSeconds int `json:"runTime10kmInSeconds"` RunTimeHalfMarathonInSeconds int `json:"runTimeHalfMarathonInSeconds"` RunTimeFullMarathonInSeconds int `json:"runTimeFullMarathonInSeconds"` CyclingOrganization string `json:"cyclingOrganization"` LicenseNumber string `json:"licenseNumber"` BigCommerceID string `json:"bigCommerceId"` AchievementLevel int `json:"achievementLevel"` TotalDistance int `json:"totalDistance"` TotalDistanceClimbed int `json:"totalDistanceClimbed"` TotalTimeInMinutes int `json:"totalTimeInMinutes"` TotalInKOMJersey int `json:"totalInKomJersey"` TotalInSprintersJersey int `json:"totalInSprintersJersey"` TotalInOrangeJersey int `json:"totalInOrangeJersey"` TotalWattHours int `json:"totalWattHours"` TotalExperiencePoints int `json:"totalExperiencePoints"` TotalGold int `json:"totalGold"` RunAchievementLevel int `json:"runAchievementLevel"` TotalRunDistance int `json:"totalRunDistance"` TotalRunTimeInMinutes int `json:"totalRunTimeInMinutes"` TotalRunExperiencePoints int `json:"totalRunExperiencePoints"` TotalRunCalories int `json:"totalRunCalories"` PowerSourceType string `json:"powerSourceType"` PowerSourceModel string `json:"powerSourceModel"` VirtualBikeModel string `json:"virtualBikeModel"` NumberOfFolloweesInCommon int `json:"numberOfFolloweesInCommon"` Affiliate string `json:"affiliate"` AvantlinkID string `json:"avantlinkId"` FundraiserID string `json:"fundraiserId"` }
type SocialFacts ¶
type SocialFacts struct { ProfileID int64 `json:"profileId"` FollowersCount int `json:"followersCount"` FolloweesCount int `json:"followeesCount"` FolloweesInCommonWithLoggedInPlayer int `json:"followeesInCommonWithLoggedInPlayer"` FollowerStatusOfLoggedInPlayer string `json:"followerStatusOfLoggedInPlayer"` FolloweeStatusOfLoggedInPlayer string `json:"followeeStatusOfLoggedInPlayer"` IsFavoriteOfLoggedInPlayer bool `json:"isFavoriteOfLoggedInPlayer"` }