GithubHelp home page GithubHelp logo

stravav3js's Introduction

strava_api_v3

StravaApiV3 - JavaScript client for strava_api_v3 Strava API This SDK is automatically generated by the Swagger Codegen project:

  • API version: 3.0.0
  • Package version: 3.0.0
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install strava_api_v3 --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your strava_api_v3 from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('strava_api_v3') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var StravaApiV3 = require('strava_api_v3');

var defaultClient = StravaApiV3.ApiClient.instance;

// Configure OAuth2 access token for authorization: strava_oauth
var strava_oauth = defaultClient.authentications['strava_oauth'];
strava_oauth.accessToken = "YOUR ACCESS TOKEN"

var api = new StravaApiV3.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 = new StravaApiV3.ERRORUNKNOWN(); // {ERRORUNKNOWN} ISO 8601 formatted date time.

var elapsedTime = 56; // {Number} In seconds.

var opts = { 
  'description': "description_example", // {String} Description of the activity.
  'distance': 3.4, // {Number} In meters.
  'trainer': 56, // {Number} Set to 1 to mark as a trainer activity.
  'photoIds': new StravaApiV3.ERRORUNKNOWN(), // {ERRORUNKNOWN} List of native photo ids to attach to the activity.
  'commute': 56 // {Number} Set to 1 to mark as commute.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createActivity(name, type, startDateLocal, elapsedTime, opts, callback);

Documentation for API Endpoints

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

Class Method HTTP request Description
StravaApiV3.ActivitiesApi createActivity POST /activities Create an Activity
StravaApiV3.ActivitiesApi getActivityById GET /activities/{id} Get Activity
StravaApiV3.ActivitiesApi getCommentsByActivityId GET /activities/{id}/comments List Activity Comments
StravaApiV3.ActivitiesApi getKudoersByActivityId GET /activities/{id}/kudos List Activity Kudoers
StravaApiV3.ActivitiesApi getLapsByActivityId GET /activities/{id}/laps List Activity Laps
StravaApiV3.ActivitiesApi getLoggedInAthleteActivities GET /athlete/activities List Athlete Activities
StravaApiV3.ActivitiesApi getZonesByActivityId GET /activities/{id}/zones Get Activity Zones
StravaApiV3.ActivitiesApi updateActivityById PUT /activities/{id} Update Activity
StravaApiV3.AthletesApi getLoggedInAthlete GET /athlete Get Authenticated Athlete
StravaApiV3.AthletesApi getLoggedInAthleteZones GET /athlete/zones Get Zones
StravaApiV3.AthletesApi getStats GET /athletes/{id}/stats Get Athlete Stats
StravaApiV3.AthletesApi updateLoggedInAthlete PUT /athlete Update Athlete
StravaApiV3.ClubsApi getClubActivitiesById GET /clubs/{id}/activities List Club Activities
StravaApiV3.ClubsApi getClubAdminsById GET /clubs/{id}/admins List Club Administrators.
StravaApiV3.ClubsApi getClubById GET /clubs/{id} Get Club
StravaApiV3.ClubsApi getClubMembersById GET /clubs/{id}/members List Club Members
StravaApiV3.ClubsApi getLoggedInAthleteClubs GET /athlete/clubs List Athlete Clubs
StravaApiV3.GearsApi getGearById GET /gear/{id} Get Equipment
StravaApiV3.RoutesApi getRouteAsGPX GET /routes/{id}/export_gpx Export Route GPX
StravaApiV3.RoutesApi getRouteAsTCX GET /routes/{id}/export_tcx Export Route TCX
StravaApiV3.RoutesApi getRouteById GET /routes/{id} Get Route
StravaApiV3.RoutesApi getRoutesByAthleteId GET /athletes/{id}/routes List Athlete Routes
StravaApiV3.RunningRacesApi getRunningRaceById GET /running_races/{id} Get Running Race
StravaApiV3.RunningRacesApi getRunningRaces GET /running_races List Running Races
StravaApiV3.SegmentEffortsApi getEffortsBySegmentId GET /segments/{id}/all_efforts List Segment Efforts
StravaApiV3.SegmentEffortsApi getSegmentEffortById GET /segment_efforts/{id} Get Segment Effort
StravaApiV3.SegmentsApi exploreSegments GET /segments/explore Explore segments
StravaApiV3.SegmentsApi getLeaderboardBySegmentId GET /segments/{id}/leaderboard Get Segment Leaderboard
StravaApiV3.SegmentsApi getLoggedInAthleteStarredSegments GET /segments/starred List Starred Segments
StravaApiV3.SegmentsApi getSegmentById GET /segments/{id} Get Segment
StravaApiV3.SegmentsApi starSegment PUT /segments/{id}/starred Star Segment
StravaApiV3.StreamsApi getActivityStreams GET /activities/{id}/streams Get Activity Streams
StravaApiV3.StreamsApi getRouteStreams GET /routes/{id}/streams Get Route Streams
StravaApiV3.StreamsApi getSegmentEffortStreams GET /segment_efforts/{id}/streams Get Segment Effort Streams
StravaApiV3.StreamsApi getSegmentStreams GET /segments/{id}/streams Get Segment Streams
StravaApiV3.UploadsApi createUpload POST /uploads Upload Activity
StravaApiV3.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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.