public class UploadServiceImpl extends StravaServiceImpl implements UploadService
Implementation of UploadService
api, requestRate, requestRateDaily| Modifier and Type | Method and Description |
|---|---|
StravaUploadResponse |
checkUploadStatus(Integer id)
Upon upload, Strava will respond with an upload ID.
|
CompletableFuture<StravaUploadResponse> |
checkUploadStatusAsync(Integer uploadId)
Upon upload, Strava will respond with an upload ID.
|
void |
clearCache()
Clear any and all cached data entries
|
static UploadService |
instance(Token token)
Returns an instance of
segment effort services |
StravaUploadResponse |
upload(StravaActivityType activityType,
String name,
String description,
Boolean _private,
Boolean trainer,
Boolean commute,
String dataType,
String externalId,
File file)
Requires write permissions, as requested during the authorization process.
|
CompletableFuture<StravaUploadResponse> |
uploadAsync(StravaActivityType activityType,
String name,
String description,
Boolean _private,
Boolean trainer,
Boolean commute,
String dataType,
String externalId,
File file)
Requires write permissions, as requested during the authorization process.
|
accessTokenIsValid, future, getToken, requestRateDailyPercentage, requestRatePercentagepublic static UploadService instance(Token token)
Returns an instance of segment effort 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 StravaUploadResponse checkUploadStatus(Integer id)
UploadServiceUpon upload, Strava will respond with an upload ID. You may use this ID to poll the status of your upload. Strava recommends polling no more than once a second. Polling more frequently is unnecessary. The mean processing time is around 8 seconds.
URL GET https://www.strava.com/api/v3/uploads/:id
checkUploadStatus in interface UploadServiceid - Upload id originally returned when the upload was doneUploadService.checkUploadStatus(java.lang.Integer)public CompletableFuture<StravaUploadResponse> checkUploadStatusAsync(Integer uploadId) throws UnauthorizedException
UploadServiceUpon upload, Strava will respond with an upload ID. You may use this ID to poll the status of your upload. Strava recommends polling no more than once a second. Polling more frequently is unnecessary. The mean processing time is around 8 seconds.
URL GET https://www.strava.com/api/v3/uploads/:id
checkUploadStatusAsync in interface UploadServiceuploadId - Upload id originally returned when the upload was doneUnauthorizedException - If the authenticated user does not have write accessUploadService.checkUploadStatusAsync(java.lang.Integer)public void clearCache()
StravaServiceClear any and all cached data entries
Primarily used when revoking/deauthorising a token so that there are no entries remaining that are associated with the token that could mistakenly get returned
clearCache in interface StravaServiceStravaService.clearCache()public StravaUploadResponse upload(StravaActivityType activityType, String name, String description, Boolean _private, Boolean trainer, Boolean commute, String dataType, String externalId, File file)
UploadServiceRequires write permissions, as requested during the authorization process.
Posting a file for upload will enqueue it for processing. Initial checks will be done for malformed data and duplicates.
URL POST https://www.strava.com/api/v3/uploads
upload in interface UploadServiceactivityType - (Optional) Type of activity being uploadedname - (Optional) if not provided, will be populated using start date and location, if availabledescription - (Optional)_private - (Optional) set to 1 to mark the resulting activity as private, 'view_private' permissions will be necessary to view the activitytrainer - (Optional) activities without lat/lng info in the file are auto marked as stationary, set to 1 to forcecommute - (Optional) set to 1 to mark as commutedataType - possible values: fit, fit.gz, tcx, tcx.gz, gpx, gpx.gzexternalId - (Optional) data filename will be used by default but should be a unique identifierfile - the actual activity data, if gzipped the data_type must end with .gzUploadService.upload(javastrava.api.v3.model.reference.StravaActivityType,
java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean,
java.lang.Boolean, java.lang.String, java.lang.String, java.io.File)public CompletableFuture<StravaUploadResponse> uploadAsync(StravaActivityType activityType, String name, String description, Boolean _private, Boolean trainer, Boolean commute, String dataType, String externalId, File file)
UploadServiceRequires write permissions, as requested during the authorization process.
Posting a file for upload will enqueue it for processing. Initial checks will be done for malformed data and duplicates.
URL POST https://www.strava.com/api/v3/uploads
uploadAsync in interface UploadServiceactivityType - (Optional) Type of activity being uploadedname - (Optional) if not provided, will be populated using start date and location, if availabledescription - (Optional)_private - (Optional) set to 1 to mark the resulting activity as private, 'view_private' permissions will be necessary to view the activitytrainer - (Optional) activities without lat/lng info in the file are auto marked as stationary, set to 1 to forcecommute - (Optional) set to 1 to mark as commutedataType - possible values: fit, fit.gz, tcx, tcx.gz, gpx, gpx.gzexternalId - (Optional) data filename will be used by default but should be a unique identifierfile - the actual activity data, if gzipped the data_type must end with .gzUploadService.uploadAsync(javastrava.api.v3.model.reference.StravaActivityType, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.String, java.lang.String, java.io.File)Copyright © 2016 Dan Shannon. All rights reserved.