peloton

package module
v0.0.0-...-d7779bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

peloton

Peloton API Go Client

Go codecov Go Report Card

Features

  • Get data about user as struct
  • Get data about instructors as struct
  • Get data about user workouts

Usage

	username := os.Getenv("username")
	password := os.Getenv("password")
	var client *peloton.PelotonClient
	client = peloton.NewPelotonClient(username, password)
	me, _ := client.Me()
	fmt.printf("%s" me)

Documentation

Overview

Package peloton provides a simple http rest client for the Peloton APIs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInitialAuthCookie

func GetInitialAuthCookie(c *resty.Client, username string, password string) (*http.Cookie, error)

GetAuthCookie method to set the peloton_session_id cookie

Types

type ApiClient

type ApiClient struct {
	Client   *resty.Client
	Username string
	Password string
	Cookie   *http.Cookie
}

APIClient to allow updates to the client instance

func NewApiClient

func NewApiClient(args ...interface{}) (*ApiClient, error)

instantiate a new instance of the API client

func (*ApiClient) GetInstructors

func (c *ApiClient) GetInstructors() (*models.Instructors, error)

Instructors method creates a request to retrieve data about the instructors

func (*ApiClient) GetSchedule

func (c *ApiClient) GetSchedule(start int, end int) (*models.ScheduleResponse, error)

GetSchedule

func (*ApiClient) GetUserWorkouts

func (c *ApiClient) GetUserWorkouts(userid string) (*models.Workouts, error)

Workouts method creates a request to retrieve workout data by userid

func (*ApiClient) GetWorkoutDetails

func (c *ApiClient) GetWorkoutDetails(workoutId string, interval string) (*models.WorkOutDetails, error)

Get specific workout details

func (*ApiClient) Me

func (c *ApiClient) Me() (*models.User, error)

Me method creates a request to retrieve data about the current user

func (*ApiClient) UpdateAuthCookie

func (c *ApiClient) UpdateAuthCookie() (*http.Cookie, error)

Update AuthCookie from client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL