All Projects → timheuer → strava-net

timheuer / strava-net

Licence: MIT license
.NET Standard library for Strava API

Programming Languages

C#
18002 projects

Strava.NET - the C# library for the Strava API v3

Strava API

This C# SDK is automatically generated by the Swagger Codegen project:

  • API version: 3.0.0
  • SDK version: 1.0.0
  • Build date: 2018-11-25T08:47:13.749-08:00
  • Build package: io.swagger.codegen.languages.CsharpDotNet2ClientCodegen

Frameworks supported

  • .NET Standard 2.0

Dependencies

Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator

Installation

Run the following command to generate the DLL

  • dotnet build

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Strava.NET.Api;
using Strava.NET.Client;
using Strava.NET.Model;

Getting Started

using System;
using System.Diagnostics;
using Strava.NET.Api;
using Strava.NET.Client;
using Strava.NET.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: strava_oauth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new ActivitiesApi();
            var name = name_example;  // string | The name of the activity.
            var type = type_example;  // string | Type of activity. For example - Run, Ride etc.
            var startDateLocal = startDateLocal_example;  // string | ISO 8601 formatted date time.
            var elapsedTime = 56;  // int? | In seconds.
            var description = description_example;  // string | Description of the activity. (optional) 
            var distance = 3.4;  // float? | In meters. (optional) 
            var trainer = 56;  // int? | Set to 1 to mark as a trainer activity. (optional) 
            var photoIds = photoIds_example;  // string | List of native photo ids to attach to the activity. (optional) 
            var commute = 56;  // int? | Set to 1 to mark as commute. (optional) 

            try
            {
                // Create an Activity
                DetailedActivity result = apiInstance.CreateActivity(name, type, startDateLocal, elapsedTime, description, distance, trainer, photoIds, commute);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ActivitiesApi.CreateActivity: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://www.strava.com/api/v3

Class Method HTTP request Description
ActivitiesApi CreateActivity POST /activities Create an Activity
ActivitiesApi GetActivityById GET /activities/{id} Get Activity
ActivitiesApi GetCommentsByActivityId GET /activities/{id}/comments List Activity Comments
ActivitiesApi GetKudoersByActivityId GET /activities/{id}/kudos List Activity Kudoers
ActivitiesApi GetLapsByActivityId GET /activities/{id}/laps List Activity Laps
ActivitiesApi GetLoggedInAthleteActivities GET /athlete/activities List Athlete Activities
ActivitiesApi GetZonesByActivityId GET /activities/{id}/zones Get Activity Zones
ActivitiesApi UpdateActivityById PUT /activities/{id} Update Activity
AthletesApi GetLoggedInAthlete GET /athlete Get Authenticated Athlete
AthletesApi GetLoggedInAthleteZones GET /athlete/zones Get Zones
AthletesApi GetStats GET /athletes/{id}/stats Get Athlete Stats
AthletesApi UpdateLoggedInAthlete PUT /athlete Update Athlete
ClubsApi GetClubActivitiesById GET /clubs/{id}/activities List Club Activities
ClubsApi GetClubAdminsById GET /clubs/{id}/admins List Club Administrators.
ClubsApi GetClubById GET /clubs/{id} Get Club
ClubsApi GetClubMembersById GET /clubs/{id}/members List Club Members
ClubsApi GetLoggedInAthleteClubs GET /athlete/clubs List Athlete Clubs
GearsApi GetGearById GET /gear/{id} Get Equipment
RoutesApi GetRouteAsGPX GET /routes/{id}/export_gpx Export Route GPX
RoutesApi GetRouteAsTCX GET /routes/{id}/export_tcx Export Route TCX
RoutesApi GetRouteById GET /routes/{id} Get Route
RoutesApi GetRoutesByAthleteId GET /athletes/{id}/routes List Athlete Routes
RunningRacesApi GetRunningRaceById GET /running_races/{id} Get Running Race
RunningRacesApi GetRunningRaces GET /running_races List Running Races
SegmentEffortsApi GetEffortsBySegmentId GET /segments/{id}/all_efforts List Segment Efforts
SegmentEffortsApi GetSegmentEffortById GET /segment_efforts/{id} Get Segment Effort
SegmentsApi ExploreSegments GET /segments/explore Explore segments
SegmentsApi GetLeaderboardBySegmentId GET /segments/{id}/leaderboard Get Segment Leaderboard
SegmentsApi GetLoggedInAthleteStarredSegments GET /segments/starred List Starred Segments
SegmentsApi GetSegmentById GET /segments/{id} Get Segment
SegmentsApi StarSegment PUT /segments/{id}/starred Star Segment
StreamsApi GetActivityStreams GET /activities/{id}/streams Get Activity Streams
StreamsApi GetSegmentEffortStreams GET /segment_efforts/{id}/streams Get segment effort streams
StreamsApi GetSegmentStreams GET /segments/{id}/streams Get Segment Streams
UploadsApi CreateUpload POST /uploads Upload Activity
UploadsApi GetUploadById GET /uploads/{uploadId} Get Upload

Documentation for Models

Documentation for Authorization

strava_oauth

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://www.strava.com/api/v3/oauth/authorize
  • Scopes:
    • read: Read public segments, public routes, public profile data, public posts, public events, club feeds, and leaderboards
    • read_all: Read private routes, private segments, and private events for the user
    • profile:read_all: Read all profile information even if the user has set their profile visibility to Followers or Only You
    • profile:write: Update the user's weight and Functional Threshold Power (FTP), and access to star or unstar segments on their behalf
    • activity:read: Read the user's activity data for activities that are visible to Everyone and Followers, excluding privacy zone data
    • activity:read_all: The same access as activity:read, plus privacy zone data and access to read the user's activities with visibility set to Only You
    • activity:write: Access to create manual activities and uploads, and access to edit any activities that are visible to the app, based on activity read access level
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].