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
uriStringOrPathstringThe path or URI string of the API endpoint to request. Cannot be null.
cancellationTokenCancellationTokenA 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
TThe 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
requestUriUriThe URI of the API endpoint to request. Cannot be null.
cancellationTokenCancellationTokenA 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
TThe 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
athleteIdlong?Optional; Athlete Id (default = logged in user).
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
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
requestUristringThe URI of the request.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
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
uriStringOrPathstringThe path or URI string to which the POST request is sent. Cannot be
null.bodyHttpContentThe request body to send with the POST request.
cancellationTokenCancellationTokenA 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
TResultThe 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
requestUriUriThe URI to which the POST request is sent. Cannot be
null.bodyHttpContentThe request body to send with the POST request.
cancellationTokenCancellationTokenA 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
TResultThe 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
uriStringOrPathstringThe path or URI String to which the PUT request is sent. Cannot be
null.bodyTBodyThe request body to send with the PUT request. May be
nullif the API allows an empty body.cancellationTokenCancellationTokenA 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
TBodyThe type of the request body to serialize and send.
TResultThe 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
requestUriUriThe URI to which the PUT request is sent. Cannot be
null.bodyTBodyThe request body to send with the PUT request. May be
nullif the API allows an empty body.cancellationTokenCancellationTokenA 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
TBodyThe type of the request body to serialize and send.
TResultThe type to which the response content is deserialized.