Skip to content

Commit

Permalink
finally get rid of the stupid List models
Browse files Browse the repository at this point in the history
  • Loading branch information
NodeJSmith committed Jan 14, 2025
1 parent 30345ce commit 8da6b4d
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 262 deletions.
2 changes: 1 addition & 1 deletion examples/challenge_tracker_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():
# challenge tracker details are detailed information about specific challenges
# this endpoint takes an equipment type and a challenge type as arguments
tread_challenge_details = otf.get_challenge_tracker_detail(EquipmentType.Treadmill, ChallengeType.Other)
print(tread_challenge_details.details[0].model_dump_json(indent=4))
print(tread_challenge_details[0].model_dump_json(indent=4))

"""
{
Expand Down
11 changes: 6 additions & 5 deletions examples/class_bookings_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
def main():
otf = Otf(user=OtfUser(USERNAME, PASSWORD))

resp = otf.get_bookings(start_date=datetime.today().date())
print(resp.model_dump_json(indent=4))
bookings = otf.get_bookings(start_date=datetime.today().date())
for b in bookings:
print(b.model_dump_json(indent=4))

studios = otf.search_studios_by_geo(40.7831, 73.9712, distance=100)

studio_uuids = [studio.studio_uuid for studio in studios.studios]
studio_uuids = [studio.studio_uuid for studio in studios]

cf = ClassFilter(
day_of_week=[DoW.TUESDAY, DoW.THURSDAY],
Expand All @@ -28,7 +29,7 @@ def main():

classes = otf.get_classes(studio_uuids=studio_uuids, filters=[cf, cf2])

print(classes.classes[0].model_dump_json(indent=4))
print(classes[0].model_dump_json(indent=4))

"""
{
Expand Down Expand Up @@ -62,7 +63,7 @@ def main():
bookings = otf.get_bookings()

print("Latest Upcoming Class:")
print(bookings.bookings[-1].model_dump_json(indent=4))
print(bookings[-1].model_dump_json(indent=4))

"""
{
Expand Down
7 changes: 4 additions & 3 deletions examples/studio_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def main():
# but you'll generally just need the first 3
# same as with classes, you can leave it blank and get the studios within 50 miles of your home studio
studios_by_geo = otf.search_studios_by_geo()
print(studios_by_geo.studios[0].model_dump_json(indent=4))
print(studios_by_geo[0].model_dump_json(indent=4))

"""
{
Expand Down Expand Up @@ -71,15 +71,16 @@ def main():

print("Studio Services")
services = otf.get_studio_services(studio_detail.studio_uuid)
print(services.model_dump_json(indent=4))
for svc in services:
print(svc.model_dump_json(indent=4))

faves = otf.get_favorite_studios()

if not faves:
otf.add_favorite_studio(otf.home_studio_uuid)

faves = otf.get_favorite_studios()
print(faves.model_dump_json(indent=4))
print(faves[0].model_dump())


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions examples/workout_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def main():
print(resp.model_dump_json(indent=4))

resp = otf.get_body_composition_list()
print(resp.data[0].model_dump_json(indent=4))
print(resp[0].model_dump_json(indent=4))

# performance summaries are historical records of your performance in workouts
# `get_performance_summaries` takes a limit (default of 30) and returns a list of summaries
data_list = otf.get_performance_summaries()
print(data_list.summaries[0].model_dump_json(indent=4))
print(data_list[0].model_dump_json(indent=4))
"""
{
"performance_summary_id": "29dd97f4-3418-4247-b35c-37eabc5e17f3",
Expand Down Expand Up @@ -50,7 +50,7 @@ def main():

# you can get detailed information about a specific performance summary by calling `get_performance_summary`
# which takes a performance_summary_id as an argument
data = otf.get_performance_summary(data_list.summaries[0].id)
data = otf.get_performance_summary(data_list[0].id)
print(data.model_dump_json(indent=4))

"""
Expand Down Expand Up @@ -110,7 +110,7 @@ def main():
# this endpoint takes a class_history_uuid, as well as a number of max data points - if you do not pass
# this value it will attempt to return enough data points for 30 second intervals

telemetry = otf.get_telemetry(performance_summary_id=data_list.summaries[0].id)
telemetry = otf.get_telemetry(performance_summary_id=data_list[0].id)
telemetry.telemetry = telemetry.telemetry[:2]
print(telemetry.model_dump_json(indent=4))

Expand Down
Loading

0 comments on commit 8da6b4d

Please sign in to comment.