Table of Contents

Interface IStravaApi

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

Strava V3 API Interface.

public interface IStravaApi

Methods

GetApiResultAsync<T>(string, CancellationToken)

Sends an asynchronous HTTP request to the specified URI and returns the result as an ApiResult<T>.

Task<ApiResult<T>> GetApiResultAsync<T>(string uriStringOrPath, CancellationToken cancellationToken = default)

Parameters

uriStringOrPath string

The path or URI string of the API endpoint to request. Cannot be null.

cancellationToken CancellationToken

A token to monitor for cancellation requests. The default value is None.

Returns

Task<ApiResult<T>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> representing the outcome of the API request, including the deserialized response data or error information.

Type Parameters

T

The type to which the response content is deserialized.

GetApiResultAsync<T>(Uri, CancellationToken)

Sends an asynchronous HTTP request to the specified URI and returns the result as an ApiResult<T>.

Task<ApiResult<T>> GetApiResultAsync<T>(Uri requestUri, CancellationToken cancellationToken = default)

Parameters

requestUri Uri

The URI of the API endpoint to request. Cannot be null.

cancellationToken CancellationToken

A token to monitor for cancellation requests. The default value is None.

Returns

Task<ApiResult<T>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> representing the outcome of the API request, including the deserialized response data or error information.

Type Parameters

T

The type to which the response content is deserialized.

GetAthleteAsync(long?, CancellationToken)

Retrieve Athlete record by Id for logged in user.

Task<ApiResult<Athlete>> GetAthleteAsync(long? athleteId = 0, CancellationToken cancellationToken = default)

Parameters

athleteId long?

Optional; Athlete Id (default = logged in user).

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ApiResult<Athlete>>

Athlete record associated with the Id.

Remarks

Returns the currently authenticated athlete. Tokens with profile:read_all scope will receive a detailed athlete representation; all others will receive a summary representation.

GetStreamAsync(string, CancellationToken)

Retrieves a stream from the Strava API.

Task<Stream> GetStreamAsync(string requestUri, CancellationToken cancellationToken = default)

Parameters

requestUri string

The URI of the request.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<Stream>

A Stream containing the API response.

Remarks

It is the responsibility of the caller to dispose of the returned stream.

PostApiResultAsync<TResult>(string, HttpContent, CancellationToken)

Sends an HTTP POST request to the specified URI string or path with the provided request body and returns the deserialized API result.

Task<ApiResult<TResult>> PostApiResultAsync<TResult>(string uriStringOrPath, HttpContent body, CancellationToken cancellationToken = default)

Parameters

uriStringOrPath string

The path or URI string to which the POST request is sent. Cannot be null.

body HttpContent

The request body to send with the POST request.

cancellationToken CancellationToken

A token to monitor for cancellation requests. The default value is None.

Returns

Task<ApiResult<TResult>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> representing the deserialized response from the API.

Type Parameters

TResult

The type to which the response content is deserialized.

PostApiResultAsync<TResult>(Uri, HttpContent, CancellationToken)

Sends an HTTP POST request to the specified URI with the provided request body and returns the deserialized API result.

Task<ApiResult<TResult>> PostApiResultAsync<TResult>(Uri requestUri, HttpContent body, CancellationToken cancellationToken = default)

Parameters

requestUri Uri

The URI to which the POST request is sent. Cannot be null.

body HttpContent

The request body to send with the POST request.

cancellationToken CancellationToken

A token to monitor for cancellation requests. The default value is None.

Returns

Task<ApiResult<TResult>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> representing the deserialized response from the API.

Type Parameters

TResult

The type to which the response content is deserialized.

PutApiResultAsync<TBody, TResult>(string, TBody?, CancellationToken)

Sends an HTTP PUT request to the specified URI with the provided request body and returns the deserialized API result.

Task<ApiResult<TResult>> PutApiResultAsync<TBody, TResult>(string uriStringOrPath, TBody? body, CancellationToken cancellationToken = default)

Parameters

uriStringOrPath string

The path or URI String to which the PUT request is sent. Cannot be null.

body TBody

The request body to send with the PUT request. May be null if the API allows an empty body.

cancellationToken CancellationToken

A token to monitor for cancellation requests. The default value is None.

Returns

Task<ApiResult<TResult>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> representing the deserialized response from the API.

Type Parameters

TBody

The type of the request body to serialize and send.

TResult

The type to which the response content is deserialized.

PutApiResultAsync<TBody, TResult>(Uri, TBody?, CancellationToken)

Sends an HTTP PUT request to the specified URI with the provided request body and returns the deserialized API result.

Task<ApiResult<TResult>> PutApiResultAsync<TBody, TResult>(Uri requestUri, TBody? body, CancellationToken cancellationToken = default)

Parameters

requestUri Uri

The URI to which the PUT request is sent. Cannot be null.

body TBody

The request body to send with the PUT request. May be null if the API allows an empty body.

cancellationToken CancellationToken

A token to monitor for cancellation requests. The default value is None.

Returns

Task<ApiResult<TResult>>

A task that represents the asynchronous operation. The task result contains an ApiResult<T> representing the deserialized response from the API.

Type Parameters

TBody

The type of the request body to serialize and send.

TResult

The type to which the response content is deserialized.