Table of Contents

Interface ISegmentsApi

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

Strava V3 Segments API Interface.

public interface ISegmentsApi : ISegmentEffortsApi
Inherited Members

Methods

ExploreSegmentsAsync(Bounds, string?, int?, int?, CancellationToken)

Returns a list of the top 10 segments matching a specified query.

Task<ApiResult<SegmentList>> ExploreSegmentsAsync(Bounds bounds, string? activityType = null, int? minimumCategory = null, int? maximumCategory = null, CancellationToken cancellationToken = default)

Parameters

bounds Bounds

The geographical bounds within which to search for segments.

activityType string

The type of activity (e.g., "running", "riding") to filter segments.

minimumCategory int?

The minimum climb category to filter segments (optional).

maximumCategory int?

The maximum climb category to filter segments (optional).

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<SegmentList>>

An instance of ApiResult<T> where T is SegmentList.

GetSegmentAsync(long, CancellationToken)

Gets a detailed segment by its unique identifier.

Task<ApiResult<DetailedSegment>> GetSegmentAsync(long id, CancellationToken cancellationToken = default)

Parameters

id long

The unique identifier of the segment.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ApiResult<DetailedSegment>>

An ApiResult<T> containing the DetailedSegment if successful; otherwise, an error.

ListStarredSegmentsAsync(int?, int?, CancellationToken)

Returns a list of the authenticated athlete's starred segments.

Task<ApiResult<List<Segment>>> ListStarredSegmentsAsync(int? page = null, int? perPage = null, CancellationToken cancellationToken = default)

Parameters

page int?

Page number (optional).

perPage int?

Number of items per page (optional).

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<List<Segment>>>

An instance of ApiResult<T> where T is List<T>.

StarSegmentAsync(long, bool, CancellationToken)

Stars or unstars the specified segment asynchronously for the authenticated user.

Task<ApiResult<Segment>> StarSegmentAsync(long id, bool removeStar = false, CancellationToken cancellationToken = default)

Parameters

id long

The unique identifier of the segment to star or unstar.

removeStar bool

If true, removes the star from the segment; otherwise, adds a star. The default is false.

cancellationToken CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<ApiResult<Segment>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> with the updated segment details.

UnstarSegmentAsync(long, CancellationToken)

Removes the authenticated athlete's star from the specified segment asynchronously.

Task<ApiResult<Segment>> UnstarSegmentAsync(long id, CancellationToken cancellationToken = default)

Parameters

id long

The identifier of the segment to unstar.

cancellationToken CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<ApiResult<Segment>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> with details of the updated segment.