Table of Contents

Interface IActivitiesApi

Namespace
Tudormobile.Strava.Api
Assembly
Tudormobile.Strava.dll

Strava V3 Activities API Interface.

public interface IActivitiesApi : IStravaApi
Inherited Members

Methods

CreateActivityAsync(string, SportTypes, DateTime, long, string?, string?, double?, bool?, bool?, CancellationToken)

Creates a manual activity for an athlete, requires activity:write scope.

Task<ApiResult<DetailedActivity>> CreateActivityAsync(string name, SportTypes sportType, DateTime startDateLocal, long elapsedTime, string? type = null, string? description = null, double? distance = null, bool? trainer = null, bool? commute = null, CancellationToken cancellationToken = default)

Parameters

name string

The name of the activity.

sportType SportTypes

Sport type of activity. For example - Run, MountainBikeRide, Ride, etc.

startDateLocal DateTime

Start date and time.

elapsedTime long

Elapsed time, in seconds.

type string

Type of activity. For example - Run, Ride etc.

description string

Description of the activity.

distance double?

Distance, in meters.

trainer bool?

True if this is a trainer activity.

commute bool?

True if this is a commute activity.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<DetailedActivity>>

An ApiResult containing the DetailedActivity object representing the created activity.

GetActivitiesAsync(DateTime?, DateTime?, int?, int?, CancellationToken)

List Athlete Activities

Task<ApiResult<List<SummaryActivity>>> GetActivitiesAsync(DateTime? before = null, DateTime? after = null, int? page = 1, int? perPage = 30, CancellationToken cancellationToken = default)

Parameters

before DateTime?

Filtering activities that have taken place before a certain time.

after DateTime?

Filtering activities that have taken place after a certain time.

page int?

Page number. (Defaults to 1).

perPage int?

Number of items per page. (Defaults to 30).

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<List<SummaryActivity>>>

An array of SummaryActivity objects.

Remarks

Returns the activities of an athlete for a specific identifier. Requires activity:read. Only Me activities will be filtered out unless requested by a token with activity:read_all.

If the before parameter is not provided, the current date and time is assumed. If the after parameter is not provided, all available activities are returned. The page and per_page parameters are used to limit the number of activities returned.

GetActivityAsync(long, bool?, CancellationToken)

Get Activity

Task<ApiResult<DetailedActivity>> GetActivityAsync(long id, bool? includeAllEfforts = false, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the activity.

includeAllEfforts bool?

True to include all segments efforts.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<DetailedActivity>>

The activity's detailed representation. An instance of DetailedActivity.

GetActivityZones(long, CancellationToken)

Returns the zones of a given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Task<ApiResult<List<ActivityZone>>> GetActivityZones(long id, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the activity.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<List<ActivityZone>>>

An collection of ActivityZone objects.

ListActivityCommentsAsync(long, string?, int?, CancellationToken)

Returns the comments on the given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Task<ApiResult<List<Comment>>> ListActivityCommentsAsync(long id, string? afterCursor = null, int? pageSize = null, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the activity.

afterCursor string

Cursor of the last item in the previous page of results, used to request the subsequent page of results. When omitted, the first page of results is fetched.

pageSize int?

Number of items per page. Defaults to the Strava V3 API default size (currently 30).

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<List<Comment>>>

A list of Comments.

ListActivityKudoersAsync(long, int?, int?, CancellationToken)

Returns the athletes who kudoed an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Task<ApiResult<List<SummaryAthlete>>> ListActivityKudoersAsync(long id, int? page = null, int? perPage = null, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the activity.

page int?

Page number. Defaults to Strava V3 API default (currently 1).

perPage int?

Number of items per page. Strava V3 API default (currently 30). A token to monitor for cancellation requests.

cancellationToken CancellationToken

Returns

Task<ApiResult<List<SummaryAthlete>>>

A list of SummaryAthlete objects.

ListActivityLaps(long, CancellationToken)

Returns the laps of an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Task<ApiResult<List<Lap>>> ListActivityLaps(long id, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the activity.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<List<Lap>>>

A collection of Lap objects.

UpdateActivityAsync(long, UpdatableActivity, CancellationToken)

Update Activity

Task<ApiResult<DetailedActivity>> UpdateActivityAsync(long id, UpdatableActivity activity, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the activity.

activity UpdatableActivity

An instance of UpdatableActivity.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<DetailedActivity>>

The activity's detailed representation. An instance of DetailedActivity.

Remarks

Updates the given activity that is owned by the authenticated athlete. Requires activity:write. Also requires activity:read_all in order to update Only Me activities