StravaApiV3Sharp 1.4.1
dotnet add package StravaApiV3Sharp --version 1.4.1
NuGet\Install-Package StravaApiV3Sharp -Version 1.4.1
<PackageReference Include="StravaApiV3Sharp" Version="1.4.1" />
<PackageVersion Include="StravaApiV3Sharp" Version="1.4.1" />
<PackageReference Include="StravaApiV3Sharp" />
paket add StravaApiV3Sharp --version 1.4.1
#r "nuget: StravaApiV3Sharp, 1.4.1"
#:package StravaApiV3Sharp@1.4.1
#addin nuget:?package=StravaApiV3Sharp&version=1.4.1
#tool nuget:?package=StravaApiV3Sharp&version=1.4.1
Introduction
This is a .NET implementation of the Strava v3 API. It implements all Models and Endpoints documented on Strava API and SDK Reference. Since this documentation does not reflect the API behaviour in total some adaptions needed to be made.
Documentation
Find the detailed documentation of all Endpoints and Models in the StravaApiV3Sharp Documentation
Getting Started
- Get started with your API on the Strava getting started page
- Create a Visual Studio Project and add the NuGet Package StravaApiV3Sharp.
- Use the clientId and clientSecret from the strava api page to establish a connection between your app and the strava service
[STAThread]
static void Main()
{
// define the strava client specific info
int clientId = 12345;
string clientSecret = "abcdefghijklmnopqrstuvwxyz";
// define the text file that holds the user authentication info
string stravaAuth = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "stravaApi.txt");
string serializedApi = System.IO.File.Exists(stravaAuth) ? System.IO.File.ReadAllText(stravaAuth) : null;
string callbackUrl = "http://localhost/doesNotExist/";
// create an instance of the api and reload the local stored auth info
var api = new de.schumacher_bw.Strava.StravaApiV3Sharp(clientId, clientSecret, serializedApi);
// add a delegate to the event of the refreshToken or authToken been updated
api.SerializedObjectChanged += (s, e) => System.IO.File.WriteAllText(stravaAuth, api.Serialize());
// create a winform that contains a browser
var form = new System.Windows.Forms.Form() { Width = 1000, Height = 1000 };
var webView = new Microsoft.Toolkit.Forms.UI.Controls.WebView();
((System.ComponentModel.ISupportInitialize)webView).BeginInit();
webView.Dock = System.Windows.Forms.DockStyle.Fill;
form.Controls.Add(webView);
((System.ComponentModel.ISupportInitialize)webView).EndInit();
// in case the app is not yet connected to the api => start the authentication prozedure
if (api.Authentication.Scope == de.schumacher_bw.Strava.Model.Scopes.None_Unknown)
{
// ensure to be called again once the authentication is done.
// We will be forewared to a not existing url and catch this event
webView.NavigationStarting += (s, e) =>
{
if (e.Uri?.AbsoluteUri.StartsWith(callbackUrl) ?? false) // in case we are forewarded to the callback URL
{
api.Authentication.DoTokenExchange(e.Uri); // do the token exchange with the stava api
ShowInfoInBrowser(api, webView);
}
};
// navigate to the strava auth page to get read access
webView.Navigate(api.Authentication.GetAuthUrl(new Uri(callbackUrl), de.schumacher_bw.Strava.Model.Scopes.Read));
}
else // the api is allready connected and the information have been loaded from the stravaAuth-file
{
ShowInfoInBrowser(api, webView);
}
form.ShowDialog();
form.Dispose();
}
private static void ShowInfoInBrowser(de.schumacher_bw.Strava.StravaApiV3Sharp api, Microsoft.Toolkit.Forms.UI.Controls.WebView webView)
{
var athlete = api.Athletes.GetLoggedInAthlete();
webView.NavigateToString(String.Format("<h1>Hello {0}</h1>", athlete.Firstname));
}
Terms of Use
- License: MIT
- Ensure your a pp is complain to the Strava API Agreement
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- FubarCoder.RestSharp.Portable.HttpClient (>= 4.0.8)
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release 1.4.1 with a readme.md added
Release 1.4.0 with updated features of the Strava Api:
* Additional SportTypes in the "ActivitySportType" enum
* Added the Commen.Cursor property and to get comments with the "afterCurser" parameter in the Activities.GetCommentByActivityId