Skip to content

Commit 248f43a

Browse files
Add demo for get_scheduled_workout_by_id method
Add interactive demo that prompts user for scheduled workout ID with validation for required input and numeric format.
1 parent c671d65 commit 248f43a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

demo.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ def __init__(self):
268268
"l": {"desc": "Set activity type", "key": "set_activity_type"},
269269
"m": {"desc": "Create manual activity", "key": "create_manual_activity"},
270270
"n": {"desc": "Delete activity", "key": "delete_activity"},
271+
"o": {
272+
"desc": "Get scheduled workout by ID",
273+
"key": "get_scheduled_workout_by_id",
274+
},
271275
},
272276
},
273277
"6": {
@@ -1906,6 +1910,25 @@ def clean_step_ids(workout_segments):
19061910
print("💡 Workout data validation failed")
19071911

19081912

1913+
def get_scheduled_workout_by_id_data(api: Garmin) -> None:
1914+
"""Get scheduled workout by ID."""
1915+
try:
1916+
scheduled_workout_id = input("Enter scheduled workout ID: ").strip()
1917+
1918+
if not scheduled_workout_id:
1919+
print("❌ Scheduled workout ID is required")
1920+
return
1921+
1922+
call_and_display(
1923+
api.get_scheduled_workout_by_id,
1924+
scheduled_workout_id,
1925+
method_name="get_scheduled_workout_by_id",
1926+
api_call_desc=f"api.get_scheduled_workout_by_id({scheduled_workout_id})",
1927+
)
1928+
except Exception as e:
1929+
print(f"❌ Error getting scheduled workout by ID: {e}")
1930+
1931+
19091932
def set_body_composition_data(api: Garmin) -> None:
19101933
"""Set body composition data."""
19111934
try:
@@ -3139,6 +3162,9 @@ def execute_api_call(api: Garmin, key: str) -> None:
31393162
"get_workout_by_id": lambda: get_workout_by_id_data(api),
31403163
"download_workout": lambda: download_workout_data(api),
31413164
"upload_workout": lambda: upload_workout_data(api),
3165+
"get_scheduled_workout_by_id": lambda: get_scheduled_workout_by_id_data(
3166+
api
3167+
),
31423168
# Body Composition & Weight
31433169
"get_body_composition": lambda: call_and_display(
31443170
api.get_body_composition,

0 commit comments

Comments
 (0)