Documentation
¶
Overview ¶
Package client provides a wrapper around the generated Strava API client. It provides a more convenient interface for interacting with the API.
Index ¶
- Variables
- type APIClient
- type ActivitiesAPI
- type AthletesAPI
- type ClubsAPI
- type CreateUploadParams
- type ExploreSegmentsOpts
- type GearsAPI
- type GetActivityByIdOpts
- type GetClubActivitiesByIdOpts
- type GetClubAdminsByIdOpts
- type GetClubMembersByIdOpts
- type GetCommentsByActivityIdOpts
- type GetEffortsBySegmentIdOpts
- type GetKudoersByActivityIdOpts
- type GetLoggedInAthleteActivitiesOpts
- type GetLoggedInAthleteClubsOpts
- type GetLoggedInAthleteStarredSegmentsOpts
- type GetRoutesByAthleteIdOpts
- type RoutesAPI
- type SegmentEffortsAPI
- type SegmentsAPI
- type StreamsAPI
- type UpdateActivityByIdOpts
- type UploadsAPI
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyOptions = errors.New("too many options")
ErrTooManyOptions is returned when too many options are passed to a function
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { Activities ActivitiesAPI Athletes AthletesAPI Clubs ClubsAPI Routes RoutesAPI Gears GearsAPI SegmentEfforts SegmentEffortsAPI Segments SegmentsAPI Streams StreamsAPI Uploads UploadsAPI }
APIClient is a wrapper around the generated Strava API client. It provides a more convenient interface for interacting with the API.
func NewAPIClient ¶
NewAPIClient creates a new APIClient. Requires a Strava API token.
type ActivitiesAPI ¶
type ActivitiesAPI interface { // CreateActivity creates a manual activity for an athlete, requires activity:write scope CreateActivity(ctx context.Context, name string, activityType string, sportType string, startDateLocal time.Time, elapsedTime int32, description string, distance float32, trainer int32, commute int32) (models.DetailedActivity, error) // GetActivityById gets the given activity, requires activity:read scope GetActivityById(ctx context.Context, id int64, opts ...GetActivityByIdOpts) (models.DetailedActivity, error) // GetCommentsByActivityId gets comments for the given activity id, requires activity:read scope GetCommentsByActivityId(ctx context.Context, id int64, opts ...GetCommentsByActivityIdOpts) ([]models.Comment, error) // GetKudoersByActivityId gets kudoers for the given activity id, requires activity:read scope GetKudoersByActivityId(ctx context.Context, id int64, opts ...GetKudoersByActivityIdOpts) ([]models.SummaryAthlete, error) // GetLapsByActivityId gets laps for the given activity id, requires activity:read scope GetLapsByActivityId(ctx context.Context, id int64) ([]models.Lap, error) // GetLoggedInAthleteActivities gets activities for the authenticated athlete, requires activity:read scope GetLoggedInAthleteActivities(ctx context.Context, opts ...GetLoggedInAthleteActivitiesOpts) ([]models.SummaryActivity, error) // GetZonesByActivityId gets zones for a given activity, requires activity:read_all scope GetZonesByActivityId(ctx context.Context, id int64) ([]models.ActivityZone, error) // UpdateActivityById updates the given activity, requires activity:write scope UpdateActivityById(ctx context.Context, id int64, opts ...UpdateActivityByIdOpts) (models.DetailedActivity, error) }
ActivitiesAPI is an interface for interacting with activities endpoints of Strava API
type AthletesAPI ¶
type AthletesAPI interface { // GetLoggedInAthlete returns the currently authenticated athlete GetLoggedInAthlete(ctx context.Context) (models.DetailedAthlete, error) // GetLoggedInAthleteZones returns the the authenticated athlete's heart rate and power zones GetLoggedInAthleteZones(ctx context.Context) (models.Zones, error) // GetStats returns the activity stats of an athlete GetStats(ctx context.Context, id int64) (models.ActivityStats, error) // UpdateLoggedInAthlete updates the currently authenticated athlete UpdateLoggedInAthlete(ctx context.Context, weight float32) (models.DetailedAthlete, error) }
AthletesAPI is an interface for interacting with athletes endpoints of Strava API
type ClubsAPI ¶
type ClubsAPI interface { // GetClubActivitiesById returns a list of the recent activities performed by members of a given club GetClubActivitiesById(ctx context.Context, id int64, opts ...GetClubActivitiesByIdOpts) ([]models.ClubActivity, error) // GetClubAdminsById returns a list of the administrators of a given club GetClubAdminsById(ctx context.Context, id int64, opts ...GetClubAdminsByIdOpts) ([]models.SummaryAthlete, error) // GetClubById returns a given club using its identifier GetClubById(ctx context.Context, id int64) (models.DetailedClub, error) // GetClubMembersById returns a list of the athletes who are members of a given club GetClubMembersById(ctx context.Context, id int64, opts ...GetClubMembersByIdOpts) ([]models.ClubAthlete, error) // GetLoggedInAthleteClubs returns a list of the clubs whose membership includes the authenticated athlete GetLoggedInAthleteClubs(ctx context.Context, opts ...GetLoggedInAthleteClubsOpts) ([]models.SummaryClub, error) }
ClubsAPI is an interface for interacting with clubs endpoints of Strava API
type CreateUploadParams ¶
type CreateUploadParams struct { File io.Reader Name *string Description *string Trainer *string Commute *string DataType *string ExternalId *string }
CreateUploadParams is an option for CreateUpload method
type ExploreSegmentsOpts ¶
ExploreSegmentsOpts is a set of optional parameters for ExploreSegments method
type GearsAPI ¶
type GearsAPI interface { // GetGearById returns a detailed representation for the gear with given id GetGearById(ctx context.Context, id string) (models.DetailedGear, error) }
GearsAPI iis an interface for interacting with gears endpoints of Strava API
type GetActivityByIdOpts ¶
type GetActivityByIdOpts struct {
IncludeAllEfforts *bool `json:"include_all_efforts,omitempty"`
}
GetActivityByIdOpts is an options type for GetActivityById
type GetClubActivitiesByIdOpts ¶
GetClubActivitiesByIdOpts is an option for GetClubActivitiesById.
type GetClubAdminsByIdOpts ¶
GetClubAdminsByIdOpts is an option for GetClubAdminsById.
type GetClubMembersByIdOpts ¶
GetClubMembersByIdOpts is an option for GetClubMembersById.
type GetCommentsByActivityIdOpts ¶
type GetCommentsByActivityIdOpts struct { Page *int32 `json:"page,omitempty"` PerPage *int32 `json:"per_page,omitempty"` PageSize *int32 `json:"page_size,omitempty"` AfterCursor *string `json:"after,omitempty"` }
GetCommentsByActivityIdOpts is an options type for GetCommentsByActivityId
type GetEffortsBySegmentIdOpts ¶
type GetEffortsBySegmentIdOpts struct { StartDateLocal *time.Time EndDateLocal *time.Time PerPage *int32 }
GetEffortsBySegmentIdOpts is an options struct for GetEffortsBySegmentId method
type GetKudoersByActivityIdOpts ¶
type GetKudoersByActivityIdOpts struct { Page *int32 `json:"page,omitempty"` PerPage *int32 `json:"per_page,omitempty"` }
GetKudoersByActivityIdOpts is an options type for GetKudoersByActivityId
type GetLoggedInAthleteActivitiesOpts ¶
type GetLoggedInAthleteActivitiesOpts struct { Before *int64 `json:"before,omitempty"` After *int64 `json:"after,omitempty"` Page *int32 `json:"page,omitempty"` PerPage *int32 `json:"per_page,omitempty"` }
GetLoggedInAthleteActivitiesOpts is an options type for GetLoggedInAthleteActivities
type GetLoggedInAthleteClubsOpts ¶
GetLoggedInAthleteClubsOpts is an option for GetLoggedInAthleteClubs.
type GetLoggedInAthleteStarredSegmentsOpts ¶
GetLoggedInAthleteStarredSegmentsOpts is a set of optional parameters for GetLoggedInAthleteStarredSegments method
type RoutesAPI ¶
type RoutesAPI interface { // GetRouteAsGPX returns a GPX file of the route GetRouteAsGPX(ctx context.Context, id int64) error // GetRouteAsTCX returns a TCX file of the route GetRouteAsTCX(ctx context.Context, id int64) error // GetRouteById returns a route with given id GetRouteById(ctx context.Context, id int64) (models.Route, error) // GetRoutesByAthleteId returns a list of routes for the given athlete GetRoutesByAthleteId(ctx context.Context, opts ...GetRoutesByAthleteIdOpts) ([]models.Route, error) }
RoutesAPI is an interface for interacting with routes endpoints of Strava API
type SegmentEffortsAPI ¶
type SegmentEffortsAPI interface { // GetEffortsBySegmentId returns a set of the authenticated athlete's segment efforts for a given segment GetEffortsBySegmentId(ctx context.Context, segmentId int32, opts ...GetEffortsBySegmentIdOpts) ([]models.DetailedSegmentEffort, error) // GetSegmentEffortById returns a segment effort from an activity that is owned by the authenticated athlete GetSegmentEffortById(ctx context.Context, id int64) (models.DetailedSegmentEffort, error) }
SegmentEffortsAPI is an interface for interacting with segment_efforts endpoints of Strava API
type SegmentsAPI ¶
type SegmentsAPI interface { // ExploreSegments returns the top segments matching a specified query ExploreSegments(ctx context.Context, bounds []float32, opts ...ExploreSegmentsOpts) (models.ExplorerResponse, error) // GetLoggedInAthleteStarredSegments returns the segments starred by the authenticated user GetLoggedInAthleteStarredSegments(ctx context.Context, opts ...GetLoggedInAthleteStarredSegmentsOpts) ([]models.SummarySegment, error) // GetSegmentById returns the specified segment GetSegmentById(ctx context.Context, id int64) (models.DetailedSegment, error) // StarSegment stars/ unstars the given segment for the authenticated athlete StarSegment(ctx context.Context, starred bool, id int64) (models.DetailedSegment, error) }
SegmentsAPI is an interface for interacting with segments endpoints of Strava API
type StreamsAPI ¶
type StreamsAPI interface { // GetActivityStreams returns a set of streams for an activity identified by its id GetActivityStreams(ctx context.Context, id int64, keys []string, keyByType bool) (models.StreamSet, error) // GetRouteStreams returns a set of streams for a route identified by its id GetRouteStreams(ctx context.Context, id int64) (models.StreamSet, error) // GetSegmentEffortStreams returns a set of streams for a segment effort identified by its id GetSegmentEffortStreams(ctx context.Context, id int64, keys []string, keyByType bool) (models.StreamSet, error) // GetSegmentStreams returns a set of streams for a segment identified by its id GetSegmentStreams(ctx context.Context, id int64, keys []string, keyByType bool) (models.StreamSet, error) }
StreamsAPI is an interface for interacting with streams endpoints of Strava API
type UpdateActivityByIdOpts ¶
type UpdateActivityByIdOpts struct {
Body *models.UpdatableActivity
}
UpdateActivityByIdOpts is an options type for UpdateActivityById
type UploadsAPI ¶
type UploadsAPI interface { // CreateUpload creates an upload CreateUpload(ctx context.Context, opts ...CreateUploadParams) (models.Upload, error) // GetUploadById returns an upload for a given identifier GetUploadById(ctx context.Context, uploadId int64) (models.Upload, error) }
UploadsAPI is an interface for interacting with uploads endpoints of Strava API