npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

peloton-client-node

v0.4.0

Published

Client for using the peloton API in Node

Downloads

8

Readme

peloton-client-node

Currently a work in progress and not associated with Peloton.

A node client for making requests to the Peloton API.

Usage

const { peloton } = require('peloton-client-node');

async function example() {
  await peloton.authenticate({
    username: 'your-peloton-username-or-email',
    password: 'your-peloton-password',
  });

  // Get your own personal information
  const myInfo = await peloton.me();

  // Get your workout info
  const myLast10Workouts = await peloton.workouts({
    limit: 10,
    page: 0,
  });
}

Documenation

peloton.authenticate(options)

Description

Authenticates the session. Must be called before any other methods are called.

Arguments

  • options - options object
    • username - the username or email of the authenticating Peloton account (required)
    • password - the password of the authenticating Peloton account (required)

Usage

await peloton.authenticate({
  username: 'your-peloton-username-or-email',
  password: 'your-peloton-password',
});

peloton.me()

Description

Gets the authenticated users information. Must have called peloton.authenticate before this method can be used.

Usage

await peloton.me();

peloton.user(options)

Description

Gets the details of the specified user or yourself if none is specified.

Arguments

  • options - options object
    • userId - the ID of the user to fetch information of (default: authenticated userId)

Usage

const userInfo = await peloton.user({ userId: 'some-user-id' });

peloton.followers(options)

Description

Get the followers of the authenticated user or a specified user.

Arguments

  • options - options object
    • userId - specify the user to retrieve the followers of (default: authenticated userId)
    • limit - limit the number of workouts returned (default: 10)
    • page - the page of the results to fetch (default: 0)

Usage

const followers = await peloton.followers({
  userId: 'some-peloton-user-id',
  limit: 100,
  page: 0,
});

peloton.following(options)

Description

Get the users following the authenticated user or a specified user.

Arguments

  • options - options object
    • userId - specify the user to retrieve those who are following (default: authenticated userId)
    • limit - limit the number of workouts returned (default: 10)
    • page - the page of the results to fetch (default: 0)

Usage

const following = await peloton.following({
  userId: 'some-peloton-user-id',
  limit: 100,
  page: 0,
});

peloton.workouts(options)

Description

Gets the workouts of the authenticated user or a specified user.

Arguments

  • options - options object
    • userId - specify the user to retrieve the workouts of (default: authenticated userId)
    • limit - limit the number of workouts returned (default: 10)
    • page - the page of the results to fetch (default: 0)
    • joins - UNSURE: some sort of join key. I believe it may expand the keys provided (default: 'ride')

Usage

const workoutsRes = await peloton.workouts({
  limit: 100,
  page: 0,
  joins: 'ride',
});

peloton.workout(options)

Description

Get the details of a specified workout

Arguments

  • options - options object
    • workoutId - the ID of the workout to retrieve (required)

Usage

const workoutRes = await peloton.workout({ workoutId: 'some-workout-id' });

peloton.workoutPerformanceGraph(options)

Description

Get the data used to build a performance graph for a specific workout.

Arguments

  • options - options object
    • workoutId - the ID of the workout to retrieve the graph data for (required)
    • everyN - an integer value defining the granularity of data received, in seconds (default: 5)

Usage

const workoutPerformanceGraphRes = await peloton.workoutPerformanceGraph({ 
  workoutId: 'some-workout-id',
  everyN: 30,
});

peloton.ride(options)

Description

Get inforamtion about a specific ride.

Arguments

  • options - options object
    • rideId - the ID of the ride to retrieve the information for (required)

Usage

const rideRes = await peloton.ride({ rideId: 'some-ride-id' });

peloton.rideDetails(options)

Description

Get details about a specific ride.

Arguments

  • options - options object
    • rideId - the ID of the ride to retrieve the information for (required)

Usage

const rideDetailsRes = await peloton.rideDetails({ rideId: 'some-ride-id' });

References

This was inspred from this python library as well as the API Docs written there.