public class ActivityServiceImpl extends StravaServiceImpl<ActivityAPI> implements ActivityService
requestRate, requestRateDaily, restService| Modifier and Type | Method and Description |
|---|---|
StravaComment |
createComment(Integer id,
String text)
Create a comment on an activity.
|
StravaActivity |
createManualActivity(StravaActivity activity)
This API endpoint is for creating manually entered
activities. |
StravaActivity |
deleteActivity(Integer id)
Deletes the identified
StravaActivity |
void |
deleteComment(Integer activityId,
Integer commentId)
Delete a comment belonging to the authenticated user
|
void |
deleteComment(StravaComment comment)
Delete a comment belonging to the authenticated user
|
StravaActivity |
getActivity(Integer id)
StravaActivity details, including segment efforts, splits and best efforts, are only available to the owner of the activity.
|
StravaActivity |
getActivity(Integer id,
Boolean includeAllEfforts)
StravaActivity details, including segment efforts, splits and best efforts, are only available to the owner of the activity.
|
void |
giveKudos(Integer activityId)
Kudo an activity (kudo is given by the authenticated athlete).
|
static ActivityService |
instance(Token token)
Returns an instance of
activity services |
List<StravaComment> |
listActivityComments(Integer id)
Comments on an activity can be viewed by any user.
|
List<StravaComment> |
listActivityComments(Integer id,
Boolean markdown)
Comments on an activity can be viewed by any user.
|
List<StravaComment> |
listActivityComments(Integer id,
Boolean markdown,
Paging pagingInstruction)
Comments on an activity can be viewed by any user.
|
List<StravaComment> |
listActivityComments(Integer id,
Paging pagingInstruction)
Comments on an activity can be viewed by any user.
|
List<StravaAthlete> |
listActivityKudoers(Integer id)
A kudos is Strava's version of a 'like' or '+1'.
|
List<StravaAthlete> |
listActivityKudoers(Integer id,
Paging pagingInstruction)
A kudos is Strava's version of a 'like' or '+1'.
|
List<StravaLap> |
listActivityLaps(Integer id)
This resource will return all laps for an activity.
|
List<StravaPhoto> |
listActivityPhotos(Integer id)
Photos are external objects associated with an activity.
|
List<StravaActivityZone> |
listActivityZones(Integer id)
Heartrate and power zones are set by the
athlete. |
List<StravaComment> |
listAllActivityComments(Integer activityId)
List ALL comments on an activity, regardless of how many there are
|
List<StravaAthlete> |
listAllActivityKudoers(Integer activityId)
List ALL kudoers on an activity, regardless of how many there are
|
List<StravaActivity> |
listAllAuthenticatedAthleteActivities()
This endpoint returns a list of
activities for the authenticated StravaAthlete. |
List<StravaActivity> |
listAllAuthenticatedAthleteActivities(Calendar before,
Calendar after)
This endpoint returns a list of
activities for the authenticated StravaAthlete. |
List<StravaActivity> |
listAllFriendsActivities()
List the recent activities performed by those the current authenticated
StravaAthlete is following. |
List<StravaActivity> |
listAllRelatedActivities(Integer activityId)
List ALL related activities, regardless of how many there are
|
List<StravaActivity> |
listAuthenticatedAthleteActivities()
This endpoint returns a list of
activities for the authenticated StravaAthlete. |
List<StravaActivity> |
listAuthenticatedAthleteActivities(Calendar before,
Calendar after)
This endpoint returns a list of
activities for the authenticated StravaAthlete. |
List<StravaActivity> |
listAuthenticatedAthleteActivities(Calendar before,
Calendar after,
Paging pagingInstruction)
This endpoint returns a list of
activities for the authenticated StravaAthlete. |
List<StravaActivity> |
listAuthenticatedAthleteActivities(Paging pagingInstruction)
This endpoint returns a list of
activities for the authenticated StravaAthlete. |
List<StravaActivity> |
listFriendsActivities()
List the recent activities performed by those the current authenticated
StravaAthlete is following. |
List<StravaActivity> |
listFriendsActivities(Paging pagingInstruction)
List the recent activities performed by those the current authenticated
StravaAthlete is following. |
List<StravaActivity> |
listRelatedActivities(Integer id)
Returns the activities that were matched as "with this group".
|
List<StravaActivity> |
listRelatedActivities(Integer id,
Paging pagingInstruction)
Returns the activities that were matched as "with this group".
|
StravaActivity |
updateActivity(Integer id,
StravaActivityUpdate activity)
Requires write permissions, as requested during the authorization process.
|
accessTokenIsValid, getToken, requestRateDailyPercentage, requestRatePercentagepublic static ActivityService instance(Token token)
Returns an instance of activity services
Instances are cached so that if 2 requests are made for the same token, the same instance is returned
token - The Strava access token to be used in requests to the Strava APIpublic StravaActivity getActivity(Integer id, Boolean includeAllEfforts)
ActivityServiceStravaActivity details, including segment efforts, splits and best efforts, are only available to the owner of the activity.
By default, only "important" efforts are included. "Importance" is based on a number of factors and its value may change over time. Factors considered include: segment age, views and stars, if the user has hidden/shown the segment and if the effort was a PR. Note, if two activities cover the same segment, it is possible that for one activity the associated effort is "important" but not for the other.
Note that effort ids may exceed the max value for 32-bit integers. A long integer type should be used.
Each segment effort will have a hidden attribute indicating if it is "important" or not.
Returns null if the activity does not exist
URL GET https://www.strava.com/api/v3/activities/:id
getActivity in interface ActivityServiceid - The id of the activity to be returnedincludeAllEfforts - (Optional) Used to include all segment efforts in the result (if omitted or false then only "important" efforts are returned).activity is owned by the requesting athlete. Returns a summary representation for
all other requests.ActivityService.getActivity(java.lang.Integer, java.lang.Boolean)public StravaActivity createManualActivity(StravaActivity activity)
ActivityService
This API endpoint is for creating manually entered activities. To upload a FIT, TCX or GPX file see the Upload Documentation.
Requires write permissions, as requested during the authorization process.
Only updates name, activity type, startDateLocal, elapsedTime, description and distance.
If any other activity attributes are passed to the API, they are ignored when creating the activity.
If successful, returns a 201 status code along with a detailed representation of the created activity.
URL POST https://www.strava.com/api/v3/activities
createManualActivity in interface ActivityServiceactivity - The activity to be uploadedActivityService.createManualActivity(javastrava.api.v3.model.StravaActivity)public StravaActivity updateActivity(Integer id, StravaActivityUpdate activity)
ActivityServiceRequires write permissions, as requested during the authorization process.
Only updates name, type, private, commute, trainer, gear_id and description
Returns null if the activity doesn't exist on Strava
URL PUT https://www.strava.com/api/v3/activities/:id
updateActivity in interface ActivityServiceid - The identifier of the activity to be updatedactivity - The StravaActivityUpdate to be updatedStravaActivity.ActivityService.updateActivity(Integer,javastrava.api.v3.model.StravaActivityUpdate)public StravaActivity deleteActivity(Integer id)
ActivityService
Deletes the identified StravaActivity
Requires write permissions, as requested during the authorization process.
Returns null if the activity does not exist on Strava
URL DELETE https://www.strava.com/api/v3/activities/:id
deleteActivity in interface ActivityServiceid - The id of the StravaActivity to be deleted.nullActivityService.deleteActivity(java.lang.Integer)public List<StravaActivity> listAuthenticatedAthleteActivities(Calendar before, Calendar after, Paging pagingInstruction)
ActivityService
This endpoint returns a list of activities for the authenticated StravaAthlete.
Should be used with before, after or page/per_page. Using a combination will result in an error or unexpected results.
Pagination is supported.
URL GET https://www.strava.com/api/v3/athlete/activities
listAuthenticatedAthleteActivities in interface ActivityServicebefore - (Optional) result will start with activities whose start_date is before this valueafter - (Optional) result will start with activities whose start_date is after this value, sorted oldest firstpagingInstruction - (Optional) The page to be returnedStravaActivity summary representations sorted newest first by default. Will be sorted oldest first if the after
parameter is used.ActivityService.listAuthenticatedAthleteActivities(Calendar, Calendar, Paging)public List<StravaActivity> listFriendsActivities(Paging pagingInstruction)
ActivityService
List the recent activities performed by those the current authenticated StravaAthlete is following.
Pagination is supported. However, results are limited to the last 200 total activities.
URL GET https://www.strava.com/api/v3/activities/following
listFriendsActivities in interface ActivityServicepagingInstruction - (Optional) The page to be returnedActivityService.listFriendsActivities(Paging)public List<StravaActivityZone> listActivityZones(Integer id)
ActivityService
Heartrate and power zones are set by the athlete. This endpoint returns the time (seconds) in each zone for the
activity.
The distribution is not customizable.
Requires an access token associated with the owner of the activity and the owner must be a premium user.
Returns null if the activity does not exist
Pagination is not supported. Returns all activity zones for the activity.
URL GET https://www.strava.com/api/v3/activities/:id/zones
listActivityZones in interface ActivityServiceid - The id of the activity for which zones should be returnedactivity zones for the StravaActivity identifiedActivityService.listActivityZones(java.lang.Integer)public List<StravaLap> listActivityLaps(Integer id)
ActivityServiceThis resource will return all laps for an activity. Laps are triggered by athletes using their respective devices, such as Garmin watches.
Returns null if the activity does not exist
Pagination is not supported. Returns all the laps for the activity.
URL GET https://www.strava.com/api/v3/activities/:id/laps
listActivityLaps in interface ActivityServiceid - The id of the StravaActivity for which laps should be returnedlap effort summariesActivityService.listActivityLaps(java.lang.Integer)public List<StravaComment> listActivityComments(Integer id, Boolean markdown, Paging pagingInstruction)
ActivityServiceComments on an activity can be viewed by any user. However, only internal applications are allowed to create or delete them.
StravaComment posting can be enabled on a per application basis, email developers -at- strava.com for more information.
The number of comments is included in the activity summary and detail responses. Use this endpoint to retrieve a list of comments left on a given activity.
Pagination is supported.
Returns null if the StravaActivity does not exist
Returns an empty array if the StravaActivity does not contain any comments
URL GET https://www.strava.com/api/v3/activities/:id/comments
listActivityComments in interface ActivityServiceid - The id of the StravaActivity for which comments should be returnedmarkdown - (Optional) Include markdown in comments (default is false - i.e. filter outpagingInstruction - (Optional) The page to be returnedActivityService.listActivityComments(Integer, Boolean, Paging)public List<StravaAthlete> listActivityKudoers(Integer id, Paging pagingInstruction)
ActivityServiceA kudos is Strava's version of a 'like' or '+1'. The number of kudos on an activity is returned with the activity summary.
Kudos posting can be enabled on a per application basis, email developers -at- strava.com for more information.
The number of kudos is included in the activity summary and detailed representations. This endpoint is for retrieving more detailed information on the athletes who have left kudos and can only be accessed by the owner of the activity.
Returns null if the StravaActivity does not exist
Pagination is supported.
listActivityKudoers in interface ActivityServiceid - The id of the StravaActivity for which kudoers are to be listedpagingInstruction - (Optional) The page to be returnedathlete summary objects.ActivityService.listActivityKudoers(Integer, Paging)public List<StravaPhoto> listActivityPhotos(Integer id)
ActivityServicePhotos are external objects associated with an activity. Currently, the only external photo source is Instagram.
Note that Instagram does not provide taken_at information.
The number of photos is included in the activity summary and detail responses. Use this endpoint to retrieve a list of photos associated with this activity. This endpoint can only be accessed by the owner of the activity.
Returns null if the StravaActivity does not exist
Pagination is not supported. Returns all photos associated with the activity.
URL GET https://www.strava.com/api/v3/activities/:id/photos
listActivityPhotos in interface ActivityServiceid - The id of the StravaActivity for which photos are to be listedphoto objects.ActivityService.listActivityPhotos(java.lang.Integer)public List<StravaComment> listActivityComments(Integer id, Boolean markdown)
ActivityServiceComments on an activity can be viewed by any user. However, only internal applications are allowed to create or delete them.
StravaComment posting can be enabled on a per application basis, email developers -at- strava.com for more information.
The number of comments is included in the activity summary and detail responses. Use this endpoint to retrieve a list of comments left on a given activity.
Pagination is not supported. Only the first page is returned by Strava.
Returns null if the StravaActivity does not exist
Returns an empty array if the StravaActivity does not contain any comments
Pagination is not supported. Returns only the first page of activities.
URL GET https://www.strava.com/api/v3/activities/:id/comments
listActivityComments in interface ActivityServiceid - The id of the StravaActivity for which comments should be returnedmarkdown - (Optional) Include markdown in comments (default is false - i.e. filter outActivityService.listActivityComments(java.lang.Integer, java.lang.Boolean)public List<StravaAthlete> listActivityKudoers(Integer id)
ActivityServiceA kudos is Strava's version of a 'like' or '+1'. The number of kudos on an activity is returned with the activity summary.
Kudos posting can be enabled on a per application basis, email developers -at- strava.com for more information.
The number of kudos is included in the activity summary and detailed representations. This endpoint is for retrieving more detailed information on the athletes who have left kudos and can only be accessed by the owner of the activity.
Returns null if the StravaActivity does not exist
Pagination is not supported. Only the first page is returned by Strava.
listActivityKudoers in interface ActivityServiceid - The id of the StravaActivity for which kudoers are to be listedathlete summary objects.ActivityService.listActivityKudoers(java.lang.Integer)public List<StravaActivity> listAuthenticatedAthleteActivities(Calendar before, Calendar after)
ActivityService
This endpoint returns a list of activities for the authenticated StravaAthlete.
Pagination is not supported. Returns only the first page of activities.
URL GET https://www.strava.com/api/v3/athlete/activities
listAuthenticatedAthleteActivities in interface ActivityServicebefore - (Optional) result will start with activities whose start_date is before this valueafter - (Optional) result will start with activities whose start_date is after this value, sorted oldest firstStravaActivity summary representations sorted newest first by default. Will be sorted oldest first if the after
parameter is used.ActivityService.listAuthenticatedAthleteActivities(java.util.Calendar, java.util.Calendar)public List<StravaActivity> listFriendsActivities()
ActivityService
List the recent activities performed by those the current authenticated StravaAthlete is following.
Pagination is not supported. Only the first page is returned by Strava.
URL GET https://www.strava.com/api/v3/activities/following
listFriendsActivities in interface ActivityServiceActivityService.listFriendsActivities()public List<StravaActivity> listAuthenticatedAthleteActivities()
ActivityService
This endpoint returns a list of activities for the authenticated StravaAthlete.
URL GET https://www.strava.com/api/v3/athlete/activities
Pagination is not supported. Returns only the first page of activities.
listAuthenticatedAthleteActivities in interface ActivityServiceStravaActivity summary representations sorted newest first by default.ActivityService.listAuthenticatedAthleteActivities()public List<StravaActivity> listAuthenticatedAthleteActivities(Paging pagingInstruction)
ActivityService
This endpoint returns a list of activities for the authenticated StravaAthlete.
URL GET https://www.strava.com/api/v3/athlete/activities
Pagination is supported
listAuthenticatedAthleteActivities in interface ActivityServicepagingInstruction - (Optional) The page to be returnedStravaActivity summary representations sorted newest first by default. Will be sorted oldest first if the after
parameter is used.ActivityService.listAuthenticatedAthleteActivities(javastrava.util.Paging)public List<StravaActivity> listRelatedActivities(Integer id)
ActivityServiceReturns the activities that were matched as "with this group". The number equals activity.athlete_count-1.
Returns null if the StravaActivity does not exist
Pagination is not supported. Only the first page is returned by Strava.
listRelatedActivities in interface ActivityServiceid - StravaActivity id for which related activities should be listedActivityService.listRelatedActivities(java.lang.Integer)public List<StravaActivity> listRelatedActivities(Integer id, Paging pagingInstruction)
ActivityServiceReturns the activities that were matched as "with this group". The number equals activity.athlete_count-1.
Returns null if the StravaActivity does not exist
Pagination is supported.
listRelatedActivities in interface ActivityServiceid - StravaActivity id for which related activities should be listedpagingInstruction - Paging instructionsActivityService.listRelatedActivities(java.lang.Integer, javastrava.util.Paging)public StravaActivity getActivity(Integer id)
ActivityServiceStravaActivity details, including segment efforts, splits and best efforts, are only available to the owner of the activity.
By default, only "important" efforts are included. "Importance" is based on a number of undocumented factors and its value may change over time. Factors considered include: segment age, views and stars, if the user has hidden/shown the segment and if the effort was a PR. Note, if two activities cover the same segment, it is possible that for one activity the associated effort is "important" but not for the other.
Note that effort ids may exceed the max value for 32-bit integers. A long integer type should be used.
Each segment effort will have a hidden attribute indicating if it is "important" or not.
Returns null if the activity does not exist
URL GET https://www.strava.com/api/v3/activities/:id
getActivity in interface ActivityServiceid - The id of the activity to be returnedactivity is owned by the requesting athlete. Returns a summary representation for
all other requests.ActivityService.getActivity(java.lang.Integer)public List<StravaComment> listActivityComments(Integer id)
ActivityServiceComments on an activity can be viewed by any user. However, only internal applications are allowed to create or delete them.
Comment posting can be enabled on a per application basis, email developers -at- strava.com for more information.
The number of comments is included in the activity summary and detail responses. Use this endpoint to retrieve a list of comments left on a given activity.
Pagination is not supported. Only the first page is returned by Strava.
Returns null if the StravaActivity does not exist
Returns an empty array if the StravaActivity does not contain any comments
URL GET https://www.strava.com/api/v3/activities/:id/comments
listActivityComments in interface ActivityServiceid - The id of the StravaActivity for which comments should be returnedActivityService.listActivityComments(java.lang.Integer)public List<StravaComment> listActivityComments(Integer id, Paging pagingInstruction)
ActivityServiceComments on an activity can be viewed by any user. However, only internal applications are allowed to create or delete them.
Comment posting can be enabled on a per application basis, email developers -at- strava.com for more information.
The number of comments is included in the activity summary and detail responses. Use this endpoint to retrieve a list of comments left on a given activity.
Pagination is supported.
Returns null if the StravaActivity does not exist
Returns an empty array if the StravaActivity does not contain any comments
URL GET https://www.strava.com/api/v3/activities/:id/comments
listActivityComments in interface ActivityServiceid - The id of the StravaActivity for which comments should be returnedpagingInstruction - (Optional) Paging instructions. If not provided then the first page is returned.ActivityService.listActivityComments(java.lang.Integer, javastrava.util.Paging)public List<StravaActivity> listAllAuthenticatedAthleteActivities()
ActivityService
This endpoint returns a list of activities for the authenticated StravaAthlete.
Pagination is NOT supported. USE WITH CAUTION. ALL activities for the athlete will be returned, regardless of how many calls to the Strava API are required to achieve this.
URL GET https://www.strava.com/api/v3/athlete/activities
listAllAuthenticatedAthleteActivities in interface ActivityServiceStravaActivity summary representations sorted newest first by default.ActivityService.listAllAuthenticatedAthleteActivities()public StravaComment createComment(Integer id, String text) throws NotFoundException, BadRequestException
ActivityServiceCreate a comment on an activity.
Comment posting must be explicitly authorised by Strava for your application.
The comment will be made by the user associated with the access_token.
URL POST https://www.strava.com/api/v3/activities/:id/comments
createComment in interface ActivityServiceid - Activity identifiertext - Comment textNotFoundException - if the activity does not existBadRequestException - if the comment is invalidActivityService.createComment(java.lang.Integer, java.lang.String)public void deleteComment(Integer activityId, Integer commentId) throws NotFoundException
ActivityServiceDelete a comment belonging to the authenticated user
deleteComment in interface ActivityServiceactivityId - Identifier of the activity the comment was posted tocommentId - Identifier of the comment to be deletedNotFoundException - if the activity or the comment does existActivityService.deleteComment(java.lang.Integer, java.lang.Integer)public void deleteComment(StravaComment comment) throws NotFoundException
ActivityServiceDelete a comment belonging to the authenticated user
deleteComment in interface ActivityServicecomment - The comment to be deletedNotFoundException - If the comment does not exist on StravaActivityService.deleteComment(javastrava.api.v3.model.StravaComment)public void giveKudos(Integer activityId) throws NotFoundException
ActivityServiceKudo an activity (kudo is given by the authenticated athlete). You can do this multiple times, but the activity only receives one kudos.
giveKudos in interface ActivityServiceactivityId - Identifier of the activity to be kudoed.NotFoundException - If the activity does not exist on StravaActivityService.giveKudos(java.lang.Integer)public List<StravaComment> listAllActivityComments(Integer activityId)
ActivityServiceList ALL comments on an activity, regardless of how many there are
Returns null if the activity does not exist
Pagination is not supported - this method just returns ALL comments
USE WITH CAUTION - ACTIVITIES WITH MANY COMMENTS WILL REQUIRE MANY CALLS TO THE STRAVA API
listAllActivityComments in interface ActivityServiceactivityId - The activity whose comments should be listedActivityService.listAllActivityComments(java.lang.Integer)public List<StravaAthlete> listAllActivityKudoers(Integer activityId)
ActivityServiceList ALL kudoers on an activity, regardless of how many there are
Returns null if the activity does not exist
Pagination is not supported - this method just returns ALL kudoers
USE WITH CAUTION - ACTIVITIES WITH MANY KUDOS WILL REQUIRE MANY CALLS TO THE STRAVA API
listAllActivityKudoers in interface ActivityServiceactivityId - The activity whose kudoers should be listedActivityService.listAllActivityKudoers(java.lang.Integer)public List<StravaActivity> listAllRelatedActivities(Integer activityId)
ActivityServiceList ALL related activities, regardless of how many there are
Returns null if the activity does not exist
Pagination is not supported - this method just returns ALL related activities
USE WITH CAUTION - ACTIVITIES WITH MANY RELATED ACTIVITIES WILL REQUIRE MANY CALLS TO THE STRAVA API
listAllRelatedActivities in interface ActivityServiceactivityId - The activity identifierActivityService.listAllRelatedActivities(java.lang.Integer)public List<StravaActivity> listAllAuthenticatedAthleteActivities(Calendar before, Calendar after)
ActivityService
This endpoint returns a list of activities for the authenticated StravaAthlete.
Pagination is NOT supported. USE WITH CAUTION. ALL activities for the athlete will be returned, regardless of how many calls to the Strava API are required to achieve this.
URL GET https://www.strava.com/api/v3/athlete/activities
listAllAuthenticatedAthleteActivities in interface ActivityServicebefore - Return only rides started BEFORE this date/timeafter - Return only rides started AFTER this data/timeStravaActivity summary representations sorted newest first by default.ActivityService.listAllAuthenticatedAthleteActivities(java.util.Calendar, java.util.Calendar)public List<StravaActivity> listAllFriendsActivities()
ActivityService
List the recent activities performed by those the current authenticated StravaAthlete is following.
Pagination is not supported - this method just returns ALL friends' activities (although it is restricted by Strava to the last 200)
USE WITH CAUTION - ACTIVITIES WITH MANY RELATED ACTIVITIES WILL REQUIRE MANY CALLS TO THE STRAVA API
URL GET https://www.strava.com/api/v3/activities/following
listAllFriendsActivities in interface ActivityServiceActivityService.listAllFriendsActivities()Copyright © 2015 Dan Shannon. All rights reserved.