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

    Class Routines

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

    Index

    Methods

    • Creates a new routine.

      Parameters

      Returns Promise<Routine>

      A promise that resolves to the newly created routine data.

      ValidationError if the provided routine data is invalid.

      import { HevyClient, HevyClientConfig, CreateRoutineRequest, Routine } from 'hevy-sdk';

      const config: HevyClientConfig = { apiKey: 'your-api-key' };
      const client: HevyClient = new HevyClient(config);
      // Construct a valid routine object
      const validRoutineObject: CreateRoutineRequest = { ... };
      const newRoutine: Routine = await client.routines.createRoutine(validRoutineObject);
    • Retrieves a specific routine by routineID.

      Parameters

      • routineID: string

        The unique ID of the routine to retrieve.

      Returns Promise<Routine>

      A promise that resolves to the routine data for the specified routine ID.

      Error if the routineID is invalid or missing.

      import { HevyClient, HevyClientConfig, Routine } from 'hevy-sdk';

      const config: HevyClientConfig = { apiKey: 'your-api-key' };
      const client: HevyClient = new HevyClient(config);
      const routine: Routine = await client.routines.getRoutine("routine-id");
    • Retrieves a list of routines from the API.

      Parameters

      • page: number = 1

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

      • pageSize: number = 10

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

      Returns Promise<GetRoutinesResponse>

      A promise that resolves to a list of routines.

      Error if the page or pageSize is invalid.

      import { HevyClient, HevyClientConfig, GetRoutinesResponse } from 'hevy-sdk';

      const config: HevyClientConfig = { apiKey: 'your-api-key' };
      const client: HevyClient = new HevyClient(config);
      const routines: GetRoutinesResponse = await client.routines.listRoutines(1, 10);
    • Updates an existing routine.

      Parameters

      • routineID: string

        The unique ID of the routine to update.

      • data: UpdateRoutineRequest

        The updated routine data.

      Returns Promise<Routine>

      A promise that resolves to the updated routine data.

      Error if the routineID is invalid or missing.

      ValidationError if the provided routine data is invalid.

      import { HevyClient, HevyClientConfig, UpdateRoutineRequest, Routine } from 'hevy-sdk';

      const config: HevyClientConfig = { apiKey: 'your-api-key' };
      const client: HevyClient = new HevyClient(config);
      // Construct a valid update object
      const validUpdateObject: UpdateRoutineRequest = { ... };
      const updatedRoutine: Routine = await client.routines.updateRoutine("routine-id", validUpdateObject);