WorkoutApi
WorkoutApi ¶
API for managing OrangeTheory workout data.
Provides methods to retrieve workouts, performance summaries, telemetry, body composition, benchmarks, and lifetime stats. Also supports rating completed classes.
get_body_composition_list ¶
get_body_composition_list()
Get the member's body composition list.
Returns:
| Type | Description |
|---|---|
list[BodyCompositionData]
|
list[BodyCompositionData]: The member's body composition list. |
get_challenge_tracker ¶
get_challenge_tracker()
Get the member's challenge tracker content.
Returns:
| Name | Type | Description |
|---|---|---|
ChallengeTracker |
ChallengeTracker
|
The member's challenge tracker content. |
get_benchmarks ¶
get_benchmarks(challenge_category_id=0, equipment_id=0, challenge_subcategory_id=0)
Get the member's challenge tracker participation details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
challenge_category_id
|
int
|
The challenge type ID. |
0
|
equipment_id
|
EquipmentType | Literal[0]
|
The equipment ID, default is 0 - this doesn't seem to be have any impact on the results. |
0
|
challenge_subcategory_id
|
int
|
The challenge sub type ID. Default is 0 - this doesn't seem to be have any impact on the results. |
0
|
Returns:
| Type | Description |
|---|---|
list[FitnessBenchmark]
|
list[FitnessBenchmark]: The member's challenge tracker details. |
get_benchmarks_by_equipment ¶
get_benchmarks_by_equipment(equipment_id)
Get the member's challenge tracker participation details by equipment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment_id
|
EquipmentType
|
The equipment type ID. |
required |
Returns:
| Type | Description |
|---|---|
list[FitnessBenchmark]
|
list[FitnessBenchmark]: The member's challenge tracker details. |
get_benchmarks_by_challenge_category ¶
get_benchmarks_by_challenge_category(challenge_category_id)
Get the member's challenge tracker participation details by challenge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
challenge_category_id
|
int
|
The challenge type ID. |
required |
Returns:
| Type | Description |
|---|---|
list[FitnessBenchmark]
|
list[FitnessBenchmark]: The member's challenge tracker details. |
get_challenge_tracker_detail ¶
get_challenge_tracker_detail(challenge_category_id)
Get details about a challenge.
This endpoint does not (usually) return member participation, but rather details about the challenge itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
challenge_category_id
|
int
|
The challenge type ID. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FitnessBenchmark |
FitnessBenchmark
|
Details about the challenge. |
get_performance_summary ¶
get_performance_summary(performance_summary_id)
Get the details for a performance summary. Generally should not be called directly. This.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
performance_summary_id
|
str
|
The performance summary ID. |
required |
Returns:
| Type | Description |
|---|---|
PerformanceSummary
|
dict[str, Any]: The performance summary details. |
get_hr_history ¶
get_hr_history()
Get the heartrate history for the user.
Returns a list of history items that contain the max heartrate, start/end bpm for each zone, the change from the previous, the change bucket, and the assigned at time.
Returns:
| Type | Description |
|---|---|
list[TelemetryHistoryItem]
|
list[HistoryItem]: The heartrate history for the user. |
get_telemetry ¶
get_telemetry(performance_summary_id, max_data_points=150)
Get the telemetry for a performance summary.
This returns an object that contains the max heartrate, start/end bpm for each zone, and a list of telemetry items that contain the heartrate, splat points, calories, and timestamp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
performance_summary_id
|
str
|
The performance summary id. |
required |
max_data_points
|
int
|
The max data points to use for the telemetry. Default is 150, to match the app. |
150
|
Returns:
| Name | Type | Description |
|---|---|---|
TelemetryItem |
Telemetry
|
The telemetry for the class history. |
get_member_lifetime_stats_in_studio ¶
get_member_lifetime_stats_in_studio(select_time=AllTime)
Get the member's lifetime stats in studio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
select_time
|
StatsTime
|
The time period to get stats for. Default is StatsTime.AllTime. |
AllTime
|
Returns:
| Name | Type | Description |
|---|---|---|
InStudioStatsData |
InStudioStatsData
|
The member's lifetime stats in studio. |
get_member_lifetime_stats_out_of_studio ¶
get_member_lifetime_stats_out_of_studio(select_time=AllTime)
Get the member's lifetime stats out of studio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
select_time
|
StatsTime
|
The time period to get stats for. Default is StatsTime.AllTime. |
AllTime
|
Returns:
| Name | Type | Description |
|---|---|---|
OutStudioStatsData |
OutStudioStatsData
|
The member's lifetime stats out of studio. |
get_out_of_studio_workout_history ¶
get_out_of_studio_workout_history()
Get the member's out of studio workout history.
Returns:
| Type | Description |
|---|---|
list[OutOfStudioWorkoutHistory]
|
list[OutOfStudioWorkoutHistory]: The member's out of studio workout history. |
get_workout_from_booking ¶
get_workout_from_booking(booking)
Get a workout for a specific booking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
booking
|
str | BookingV2
|
The booking ID or BookingV2 object to get the workout for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Workout |
Workout
|
The member's workout. |
Raises:
| Type | Description |
|---|---|
ResourceNotFoundError
|
If the workout does not exist. |
TypeError
|
If the booking is an old Booking model, as these do not have the necessary fields. |
get_workouts ¶
get_workouts(start_date=None, end_date=None, max_data_points=150)
Get the member's workouts, using the new bookings endpoint and the performance summary endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
date | str | None
|
The start date for the workouts. If None, defaults to 30 days ago. |
None
|
end_date
|
date | str | None
|
The end date for the workouts. If None, defaults to today. |
None
|
max_data_points
|
int
|
The maximum number of data points to return for the telemetry. Default is 150. |
150
|
Returns:
| Type | Description |
|---|---|
list[Workout]
|
list[Workout]: The member's workouts. |
get_lifetime_workouts ¶
get_lifetime_workouts()
Get the member's lifetime workouts.
This is a convenience method that calls get_workouts with no date range.
Returns:
| Type | Description |
|---|---|
list[Workout]
|
list[Workout]: The member's lifetime workouts. |
Raises:
| Type | Description |
|---|---|
ResourceNotFoundError
|
If the member's created date is not set, as we cannot determine the start date for the workouts. |
rate_class_from_workout ¶
rate_class_from_workout(workout, class_rating, coach_rating)
Rate a class and coach.
The class rating must be 0, 1, 2, or 3. 0 is the same as dismissing the prompt to rate the class/coach. 1 - 3 is a range from bad to good.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workout
|
Workout
|
The workout to rate. |
required |
class_rating
|
int
|
The class rating. Must be 0, 1, 2, or 3. |
required |
coach_rating
|
int
|
The coach rating. Must be 0, 1, 2, or 3. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Workout |
Workout
|
The updated workout with the new ratings. |
Raises:
| Type | Description |
|---|---|
AlreadyRatedError
|
If the performance summary is already rated. |
ClassNotRatableError
|
If the performance summary is not rateable. |