Hevy SDK Documentation - v0.0.0
    Preparing search index...

    Class Workouts

    The Workouts class is used to interact with the workouts section of the Hevy API. It provides methods for retrieving, creating, and managing workouts on the account.

    Index

    Methods

    • Creates a new workout.

      Parameters

      • workout: {
            description?: string;
            end_time: Date;
            exercises: {
                exercise_template_id: string;
                notes?: string;
                sets?: {
                    custom_metric?: number;
                    distance_meters?: number;
                    duration_seconds?: number;
                    reps?: number;
                    rpe?: number;
                    type: string;
                    weight_kg?: number;
                }[];
                superset_id?: null
                | string;
            }[];
            is_private: boolean;
            start_time: Date;
            title: string;
        }

        The workout object to create.

      Returns Promise<any>

      The newly created workout data.

      ValidationError if the provided workout data is invalid.

      import { HevyClient } from 'hevy-sdk';

      const client = new HevyClient('your-api-key');
      const newWorkout = await workouts.createWorkout(validWorkoutObject);
    • Retrieves a specific workout by workoutID.

      Parameters

      • workoutID: string

        The unique ID of the workout to retrieve.

      Returns Promise<any>

      The workout data for the specified workout ID.

      Error if the workoutID is invalid or missing.

      import { HevyClient } from 'hevy-sdk';

      const client = new HevyClient('your-api-key');
      const workout = await client.workouts.getWorkoutByID("workout-id");
    • Retrieves the total number of workouts on the account.

      Returns Promise<any>

      The total workout count.

      Error if the API request fails.

      import { HevyClient } from 'hevy-sdk';

      const client = new HevyClient('your-api-key');
      const count = await client.workouts.getWorkoutCount();
    • Retrieves a list of workouts from the API.

      Parameters

      • page: number

        The page number for pagination. Must be a positive integer.

      • pageSize: number

        The number of workouts per page. Must be a positive integer and no greater than 10.

      Returns Promise<any>

      A list of workouts.

      Error if the page or pageSize is invalid.

      import { HevyClient } from 'hevy-sdk';

      const client = new HevyClient('your-api-key');
      const workouts = await client.workouts.getWorkouts(1, 10);