otf-api 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. otf_api/__init__.py +70 -0
  2. otf_api/__version__.py +1 -0
  3. otf_api/api.py +143 -0
  4. otf_api/classes_api.py +44 -0
  5. otf_api/member_api.py +380 -0
  6. otf_api/models/__init__.py +63 -0
  7. otf_api/models/auth.py +141 -0
  8. otf_api/models/base.py +7 -0
  9. otf_api/models/responses/__init__.py +60 -0
  10. otf_api/models/responses/bookings.py +130 -0
  11. otf_api/models/responses/challenge_tracker_content.py +38 -0
  12. otf_api/models/responses/challenge_tracker_detail.py +68 -0
  13. otf_api/models/responses/classes.py +57 -0
  14. otf_api/models/responses/enums.py +87 -0
  15. otf_api/models/responses/favorite_studios.py +106 -0
  16. otf_api/models/responses/latest_agreement.py +21 -0
  17. otf_api/models/responses/member_detail.py +134 -0
  18. otf_api/models/responses/member_membership.py +25 -0
  19. otf_api/models/responses/member_purchases.py +135 -0
  20. otf_api/models/responses/out_of_studio_workout_history.py +41 -0
  21. otf_api/models/responses/performance_summary_detail.py +77 -0
  22. otf_api/models/responses/performance_summary_list.py +67 -0
  23. otf_api/models/responses/studio_detail.py +111 -0
  24. otf_api/models/responses/studio_services.py +57 -0
  25. otf_api/models/responses/telemetry.py +53 -0
  26. otf_api/models/responses/telemetry_hr_history.py +34 -0
  27. otf_api/models/responses/telemetry_max_hr.py +13 -0
  28. otf_api/models/responses/total_classes.py +8 -0
  29. otf_api/models/responses/workouts.py +78 -0
  30. otf_api/performance_api.py +54 -0
  31. otf_api/py.typed +0 -0
  32. otf_api/studios_api.py +96 -0
  33. otf_api/telemetry_api.py +95 -0
  34. otf_api-0.2.0.dist-info/AUTHORS.md +9 -0
  35. otf_api-0.2.0.dist-info/LICENSE +21 -0
  36. otf_api-0.2.0.dist-info/METADATA +28 -0
  37. otf_api-0.2.0.dist-info/RECORD +38 -0
  38. otf_api-0.2.0.dist-info/WHEEL +4 -0
otf_api/__init__.py ADDED
@@ -0,0 +1,70 @@
1
+ from . import classes_api, member_api, studios_api, telemetry_api
2
+ from .api import Api
3
+ from .models.auth import User
4
+ from .models.responses import (
5
+ ALL_CLASS_STATUS,
6
+ ALL_HISTORY_CLASS_STATUS,
7
+ ALL_STUDIO_STATUS,
8
+ BookingList,
9
+ BookingStatus,
10
+ ChallengeTrackerContent,
11
+ ChallengeTrackerDetailList,
12
+ ChallengeType,
13
+ EquipmentType,
14
+ FavoriteStudioList,
15
+ HistoryClassStatus,
16
+ LatestAgreement,
17
+ MemberDetail,
18
+ MemberMembership,
19
+ MemberPurchaseList,
20
+ OtfClassList,
21
+ OutOfStudioWorkoutHistoryList,
22
+ PerformanceSummaryDetail,
23
+ PerformanceSummaryList,
24
+ StudioDetail,
25
+ StudioDetailList,
26
+ StudioServiceList,
27
+ StudioStatus,
28
+ Telemetry,
29
+ TelemetryHrHistory,
30
+ TelemetryMaxHr,
31
+ TotalClasses,
32
+ WorkoutList,
33
+ )
34
+
35
+ __all__ = [
36
+ "Api",
37
+ "User",
38
+ "member_api",
39
+ "BookingList",
40
+ "ChallengeTrackerContent",
41
+ "ChallengeTrackerDetailList",
42
+ "ChallengeType",
43
+ "BookingStatus",
44
+ "EquipmentType",
45
+ "HistoryClassStatus",
46
+ "LatestAgreement",
47
+ "MemberDetail",
48
+ "MemberMembership",
49
+ "MemberPurchaseList",
50
+ "OutOfStudioWorkoutHistoryList",
51
+ "StudioServiceList",
52
+ "StudioStatus",
53
+ "TotalClasses",
54
+ "WorkoutList",
55
+ "FavoriteStudioList",
56
+ "OtfClassList",
57
+ "classes_api",
58
+ "studios_api",
59
+ "telemetry_api",
60
+ "TelemetryHrHistory",
61
+ "Telemetry",
62
+ "TelemetryMaxHr",
63
+ "StudioDetail",
64
+ "StudioDetailList",
65
+ "ALL_CLASS_STATUS",
66
+ "ALL_HISTORY_CLASS_STATUS",
67
+ "ALL_STUDIO_STATUS",
68
+ "PerformanceSummaryDetail",
69
+ "PerformanceSummaryList",
70
+ ]
otf_api/__version__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.2.0"
otf_api/api.py ADDED
@@ -0,0 +1,143 @@
1
+ import asyncio
2
+ import typing
3
+ from typing import Any
4
+
5
+ import aiohttp
6
+ from loguru import logger
7
+ from yarl import URL
8
+
9
+ from otf_api.classes_api import ClassesApi
10
+ from otf_api.member_api import MemberApi
11
+ from otf_api.models.auth import User
12
+ from otf_api.performance_api import PerformanceApi
13
+ from otf_api.studios_api import StudiosApi
14
+ from otf_api.telemetry_api import TelemtryApi
15
+
16
+ if typing.TYPE_CHECKING:
17
+ from loguru import Logger
18
+
19
+ from otf_api.models.responses.member_detail import MemberDetail
20
+ from otf_api.models.responses.studio_detail import StudioDetail
21
+
22
+ API_BASE_URL = "api.orangetheory.co"
23
+ API_IO_BASE_URL = "api.orangetheory.io"
24
+ API_TELEMETRY_BASE_URL = "api.yuzu.orangetheory.com"
25
+ REQUEST_HEADERS = {"Authorization": None, "Content-Type": "application/json", "Accept": "application/json"}
26
+
27
+
28
+ class Api:
29
+ """The main class of the otf-api library. Create an instance using the async method `create`.
30
+
31
+ Example:
32
+ ---
33
+ ```python
34
+ import asyncio
35
+ from otf_api import Api
36
+
37
+ async def main():
38
+ otf = await Api.create("username", "password")
39
+ print(otf.member)
40
+
41
+ if __name__ == "__main__":
42
+ asyncio.run(main())
43
+ ```
44
+ """
45
+
46
+ logger: "Logger" = logger
47
+ user: User
48
+ session: aiohttp.ClientSession
49
+
50
+ def __init__(self, username: str, password: str):
51
+ self.member: MemberDetail
52
+ self.home_studio: StudioDetail
53
+
54
+ self.user = User.load_from_disk(username, password)
55
+ self.session = aiohttp.ClientSession()
56
+
57
+ self.member_api = MemberApi(self)
58
+ self.classes_api = ClassesApi(self)
59
+ self.studios_api = StudiosApi(self)
60
+ self.telemetry_api = TelemtryApi(self)
61
+ self.performance_api = PerformanceApi(self)
62
+
63
+ @classmethod
64
+ async def create(cls, username: str, password: str) -> "Api":
65
+ """Create a new API instance. The username and password are required arguments because even though
66
+ we cache the token, they expire so quickly that we usually end up needing to re-authenticate.
67
+
68
+ Args:
69
+ username (str): The username of the user.
70
+ password (str): The password of the user.
71
+ """
72
+ self = cls(username, password)
73
+ self.member = await self.member_api.get_member_detail()
74
+ self.home_studio = await self.studios_api.get_studio_detail(self.member.home_studio.studio_uuid)
75
+ return self
76
+
77
+ def __del__(self) -> None:
78
+ try:
79
+ loop = asyncio.get_event_loop()
80
+ asyncio.create_task(self._close_session()) # noqa
81
+ except RuntimeError:
82
+ loop = asyncio.new_event_loop()
83
+ loop.run_until_complete(self._close_session())
84
+
85
+ async def _close_session(self) -> None:
86
+ if not self.session.closed:
87
+ await self.session.close()
88
+
89
+ @property
90
+ def _base_headers(self) -> dict[str, str]:
91
+ """Get the base headers for the API."""
92
+ if not self.user:
93
+ raise ValueError("No user is logged in.")
94
+
95
+ return {
96
+ "Authorization": f"Bearer {self.user.cognito.id_token}",
97
+ "Content-Type": "application/json",
98
+ "Accept": "application/json",
99
+ }
100
+
101
+ async def _do(
102
+ self,
103
+ method: str,
104
+ base_url: str,
105
+ url: str,
106
+ params: dict[str, Any] | None = None,
107
+ headers: dict[str, str] | None = None,
108
+ ) -> Any:
109
+ """Perform an API request."""
110
+
111
+ params = params or {}
112
+ params = {k: v for k, v in params.items() if v is not None}
113
+
114
+ full_url = str(URL.build(scheme="https", host=base_url, path=url))
115
+
116
+ logger.debug(f"Making {method!r} request to {full_url}, params: {params}")
117
+
118
+ if headers:
119
+ headers.update(self._base_headers)
120
+ else:
121
+ headers = self._base_headers
122
+
123
+ async with self.session.request(method, full_url, headers=headers, params=params) as response:
124
+ response.raise_for_status()
125
+ return await response.json()
126
+
127
+ async def _classes_request(self, method: str, url: str, params: dict[str, Any] | None = None) -> Any:
128
+ """Perform an API request to the classes API."""
129
+ return await self._do(method, API_IO_BASE_URL, url, params)
130
+
131
+ async def _default_request(self, method: str, url: str, params: dict[str, Any] | None = None) -> Any:
132
+ """Perform an API request to the default API."""
133
+ return await self._do(method, API_BASE_URL, url, params)
134
+
135
+ async def _telemetry_request(self, method: str, url: str, params: dict[str, Any] | None = None) -> Any:
136
+ """Perform an API request to the Telemetry API."""
137
+ return await self._do(method, API_TELEMETRY_BASE_URL, url, params)
138
+
139
+ async def _performance_summary_request(
140
+ self, method: str, url: str, headers: dict[str, str], params: dict[str, Any] | None = None
141
+ ) -> Any:
142
+ """Perform an API request to the performance summary API."""
143
+ return await self._do(method, API_IO_BASE_URL, url, params, headers)
otf_api/classes_api.py ADDED
@@ -0,0 +1,44 @@
1
+ import typing
2
+
3
+ from otf_api.models.responses.classes import OtfClassList
4
+
5
+ if typing.TYPE_CHECKING:
6
+ from otf_api import Api
7
+
8
+
9
+ class ClassesApi:
10
+ def __init__(self, api: "Api"):
11
+ self._api = api
12
+ self.logger = api.logger
13
+
14
+ # simplify access to member_id and member_uuid
15
+ self._member_id = self._api.user.member_id
16
+ self._member_uuid = self._api.user.member_uuid
17
+
18
+ async def get_classes(
19
+ self, studio_uuids: list[str] | None = None, include_home_studio: bool = True
20
+ ) -> OtfClassList:
21
+ """Get the classes for the user.
22
+
23
+ Returns a list of classes that are available for the user, based on the studio UUIDs provided. If no studio
24
+ UUIDs are provided, it will default to the user's home studio.
25
+
26
+ Args:
27
+ studio_uuids (list[str] | None): The studio UUIDs to get the classes for. Default is None, which will\
28
+ default to the user's home studio only.
29
+ include_home_studio (bool): Whether to include the home studio in the classes. Default is True.
30
+
31
+ Returns:
32
+ OtfClassList: The classes for the user.
33
+ """
34
+
35
+ if not studio_uuids:
36
+ studio_uuids = [self._api.home_studio.studio_uuid]
37
+ elif include_home_studio and self._api.home_studio.studio_uuid not in studio_uuids:
38
+ studio_uuids.append(self._api.home_studio.studio_uuid)
39
+
40
+ path = "/v1/classes"
41
+
42
+ params = {"studio_ids": studio_uuids}
43
+ res = await self._api._classes_request("GET", path, params=params)
44
+ return OtfClassList(classes=res["items"])
otf_api/member_api.py ADDED
@@ -0,0 +1,380 @@
1
+ import typing
2
+ from datetime import date
3
+
4
+ from otf_api.models.responses.enums import BookingStatus
5
+ from otf_api.models.responses.favorite_studios import FavoriteStudioList
6
+
7
+ from .models import (
8
+ BookingList,
9
+ ChallengeTrackerContent,
10
+ ChallengeTrackerDetailList,
11
+ ChallengeType,
12
+ EquipmentType,
13
+ LatestAgreement,
14
+ MemberDetail,
15
+ MemberMembership,
16
+ MemberPurchaseList,
17
+ OutOfStudioWorkoutHistoryList,
18
+ StudioServiceList,
19
+ TotalClasses,
20
+ WorkoutList,
21
+ )
22
+
23
+ if typing.TYPE_CHECKING:
24
+ from otf_api import Api
25
+
26
+
27
+ class MemberApi:
28
+ def __init__(self, api: "Api"):
29
+ self._api = api
30
+ self.logger = api.logger
31
+
32
+ # simplify access to member_id and member_uuid
33
+ self._member_id = self._api.user.member_id
34
+ self._member_uuid = self._api.user.member_uuid
35
+
36
+ async def get_workouts(self) -> WorkoutList:
37
+ """Get the list of workouts from OT Live.
38
+
39
+ Returns:
40
+ WorkoutList: The list of workouts.
41
+
42
+ Info:
43
+ ---
44
+ This returns data from the same api the [OT Live website](https://otlive.orangetheory.com/) uses.
45
+ It is quite a bit of data, and all workouts going back to ~2019. The data includes the class history
46
+ UUID, which can be used to get telemetry data for a specific workout.
47
+ """
48
+
49
+ res = await self._api._default_request("GET", "/virtual-class/in-studio-workouts")
50
+
51
+ return WorkoutList(workouts=res["data"])
52
+
53
+ async def get_total_classes(self) -> TotalClasses:
54
+ """Get the member's total classes. This is a simple object reflecting the total number of classes attended,
55
+ both in-studio and OT Live.
56
+
57
+ Returns:
58
+ TotalClasses: The member's total classes.
59
+ """
60
+ data = await self._api._default_request("GET", "/mobile/v1/members/classes/summary")
61
+ return TotalClasses(**data["data"])
62
+
63
+ async def get_bookings(
64
+ self,
65
+ start_date: date | str | None = None,
66
+ end_date: date | str | None = None,
67
+ status: BookingStatus | None = None,
68
+ ) -> BookingList:
69
+ """Get the member's bookings.
70
+
71
+ Args:
72
+ start_date (date | str | None): The start date for the bookings. Default is None.
73
+ end_date (date | str | None): The end date for the bookings. Default is None.
74
+ status (BookingStatus | None): The status of the bookings to get. Default is None, which includes\
75
+ all statuses. Only a single status can be provided.
76
+
77
+ Returns:
78
+ BookingList: The member's bookings.
79
+
80
+ Warning:
81
+ ---
82
+ Incorrect statuses do not cause any bad status code, they just return no results.
83
+
84
+ Tip:
85
+ ---
86
+ `CheckedIn` - you must provide dates if you want to get bookings with a status of CheckedIn. If you do not
87
+ provide dates, the endpoint will return no results for this status.
88
+
89
+ Dates Notes:
90
+ ---
91
+ If dates are provided, the endpoint will return bookings where the class date is within the provided
92
+ date range. If no dates are provided, it seems to default to the current month.
93
+
94
+ In general, this endpoint does not seem to be able to access bookings older than a certain point. It seems
95
+ to be able to go back about 45 days or a month. For current/future dates, it seems to be able to go forward
96
+ to as far as you can book classes in the app, which is usually 30 days from today's date.
97
+
98
+ Developer Notes:
99
+ ---
100
+ Looking at the code in the app, it appears that this endpoint accepts multiple statuses. Indeed,
101
+ it does not throw an error if you include a list of statuses. However, only the last status in the list is
102
+ used. I'm not sure if this is a bug or if the API is supposed to work this way.
103
+ """
104
+
105
+ if isinstance(start_date, date):
106
+ start_date = start_date.isoformat()
107
+
108
+ if isinstance(end_date, date):
109
+ end_date = end_date.isoformat()
110
+
111
+ status_value = status.value if status else None
112
+
113
+ params = {"startDate": start_date, "endDate": end_date, "statuses": status_value}
114
+
115
+ res = await self._api._default_request("GET", f"/member/members/{self._member_id}/bookings", params=params)
116
+
117
+ return BookingList(bookings=res["data"])
118
+
119
+ async def _get_bookings_old(self, status: BookingStatus | None = None) -> BookingList:
120
+ """Get the member's bookings.
121
+
122
+ Args:
123
+ status (BookingStatus | None): The status of the bookings to get. Default is None, which includes
124
+ all statuses. Only a single status can be provided.
125
+
126
+ Returns:
127
+ BookingList: The member's bookings.
128
+
129
+ Raises:
130
+ ValueError: If an unaccepted status is provided.
131
+
132
+ Notes:
133
+ ---
134
+ This one is called with the param named 'status'. Dates cannot be provided, because if the endpoint
135
+ receives a date, it will return as if the param name was 'statuses'.
136
+
137
+ Note: This seems to only work for Cancelled, Booked, CheckedIn, and Waitlisted statuses. If you provide
138
+ a different status, it will return all bookings, not filtered by status. The results in this scenario do
139
+ not line up with the `get_bookings` with no status provided, as that returns fewer records. Likely the
140
+ filtered dates are different on the backend.
141
+
142
+ My guess: the endpoint called with dates and 'statuses' is a "v2" kind of thing, where they upgraded without
143
+ changing the version of the api. Calling it with no dates and a singular (limited) status is probably v1.
144
+
145
+ I'm leaving this in here for reference, but marking it private. I just don't want to have to puzzle over
146
+ this again if I remove it and forget about it.
147
+
148
+ """
149
+
150
+ if status and status not in [
151
+ BookingStatus.Cancelled,
152
+ BookingStatus.Booked,
153
+ BookingStatus.CheckedIn,
154
+ BookingStatus.Waitlisted,
155
+ ]:
156
+ raise ValueError(
157
+ "Invalid status provided. Only Cancelled, Booked, CheckedIn, Waitlisted, and None are supported."
158
+ )
159
+
160
+ status_value = status.value if status else None
161
+
162
+ params = {"status": status_value}
163
+
164
+ res = await self._api._default_request("GET", f"/member/members/{self._member_id}/bookings", params=params)
165
+
166
+ return BookingList(bookings=res["data"])
167
+
168
+ async def get_challenge_tracker_content(self) -> ChallengeTrackerContent:
169
+ """Get the member's challenge tracker content.
170
+
171
+ Returns:
172
+ ChallengeTrackerContent: The member's challenge tracker content.
173
+ """
174
+ data = await self._api._default_request("GET", f"/challenges/v3.1/member/{self._member_id}")
175
+ return ChallengeTrackerContent(**data["Dto"])
176
+
177
+ async def get_challenge_tracker_detail(
178
+ self, equipment_id: EquipmentType, challenge_type_id: ChallengeType, challenge_sub_type_id: int = 0
179
+ ) -> ChallengeTrackerDetailList:
180
+ """Get the member's challenge tracker details.
181
+
182
+ Args:
183
+ equipment_id (EquipmentType): The equipment ID.
184
+ challenge_type_id (ChallengeType): The challenge type ID.
185
+ challenge_sub_type_id (int): The challenge sub type ID. Default is 0.
186
+
187
+ Returns:
188
+ ChallengeTrackerDetailList: The member's challenge tracker details.
189
+
190
+ Notes:
191
+ ---
192
+ I'm not sure what the challenge_sub_type_id is supposed to be, so it defaults to 0.
193
+
194
+ """
195
+ params = {
196
+ "equipmentId": equipment_id.value,
197
+ "challengeTypeId": challenge_type_id.value,
198
+ "challengeSubTypeId": challenge_sub_type_id,
199
+ }
200
+
201
+ data = await self._api._default_request(
202
+ "GET", f"/challenges/v3/member/{self._member_id}/benchmarks", params=params
203
+ )
204
+
205
+ return ChallengeTrackerDetailList(details=data["Dto"])
206
+
207
+ async def get_challenge_tracker_participation(self, challenge_type_id: ChallengeType) -> typing.Any:
208
+ """Get the member's participation in a challenge.
209
+
210
+ Args:
211
+ challenge_type_id (ChallengeType): The challenge type ID.
212
+
213
+ Returns:
214
+ Any: The member's participation in the challenge.
215
+
216
+ Notes:
217
+ ---
218
+ I've never gotten this to return anything other than invalid response. I'm not sure if it's a bug
219
+ in my code or the API.
220
+
221
+ """
222
+ params = {"challengeTypeId": challenge_type_id.value}
223
+
224
+ data = await self._api._default_request(
225
+ "GET", f"/challenges/v1/member/{self._member_id}/participation", params=params
226
+ )
227
+ return data
228
+
229
+ async def get_member_detail(
230
+ self, include_addresses: bool = True, include_class_summary: bool = True, include_credit_card: bool = False
231
+ ) -> MemberDetail:
232
+ """Get the member details.
233
+
234
+ Args:
235
+ include_addresses (bool): Whether to include the member's addresses in the response.
236
+ include_class_summary (bool): Whether to include the member's class summary in the response.
237
+ include_credit_card (bool): Whether to include the member's credit card information in the response.
238
+
239
+ Returns:
240
+ MemberDetail: The member details.
241
+
242
+
243
+ Notes:
244
+ ---
245
+ The include_addresses, include_class_summary, and include_credit_card parameters are optional and determine
246
+ what additional information is included in the response. By default, all additional information is included,
247
+ with the exception of the credit card information.
248
+
249
+ The base member details include the last four of a credit card regardless of the include_credit_card,
250
+ although this is not always the same details as what is in the member_credit_card field. There doesn't seem
251
+ to be a way to exclude this information, and I do not know which is which or why they differ.
252
+ """
253
+
254
+ include: list[str] = []
255
+ if include_addresses:
256
+ include.append("memberAddresses")
257
+
258
+ if include_class_summary:
259
+ include.append("memberClassSummary")
260
+
261
+ if include_credit_card:
262
+ include.append("memberCreditCard")
263
+
264
+ params = {"include": ",".join(include)} if include else None
265
+
266
+ data = await self._api._default_request("GET", f"/member/members/{self._member_id}", params=params)
267
+ return MemberDetail(**data["data"])
268
+
269
+ async def get_member_membership(self) -> MemberMembership:
270
+ """Get the member's membership details.
271
+
272
+ Returns:
273
+ MemberMembership: The member's membership details.
274
+ """
275
+
276
+ data = await self._api._default_request("GET", f"/member/members/{self._member_id}/memberships")
277
+ return MemberMembership(**data["data"])
278
+
279
+ async def get_member_purchases(self) -> MemberPurchaseList:
280
+ """Get the member's purchases, including monthly subscriptions and class packs.
281
+
282
+ Returns:
283
+ MemberPurchaseList: The member's purchases.
284
+ """
285
+ data = await self._api._default_request("GET", f"/member/members/{self._member_id}/purchases")
286
+ return MemberPurchaseList(data=data["data"])
287
+
288
+ async def get_out_of_studio_workout_history(self) -> OutOfStudioWorkoutHistoryList:
289
+ """Get the member's out of studio workout history.
290
+
291
+ Returns:
292
+ OutOfStudioWorkoutHistoryList: The member's out of studio workout history.
293
+ """
294
+ data = await self._api._default_request("GET", f"/member/members/{self._member_id}/out-of-studio-workout")
295
+
296
+ return OutOfStudioWorkoutHistoryList(data=data["data"])
297
+
298
+ async def get_favorite_studios(self) -> FavoriteStudioList:
299
+ """Get the member's favorite studios.
300
+
301
+ Returns:
302
+ FavoriteStudioList: The member's favorite studios.
303
+ """
304
+ data = await self._api._default_request("GET", f"/member/members/{self._member_id}/favorite-studios")
305
+
306
+ return FavoriteStudioList(studios=data["data"])
307
+
308
+ async def get_latest_agreement(self) -> LatestAgreement:
309
+ """Get the latest agreement for the member.
310
+
311
+ Returns:
312
+ LatestAgreement: The agreement.
313
+
314
+ Notes:
315
+ ---
316
+ In this context, "latest" means the most recent agreement with a specific ID, not the most recent agreement
317
+ in general. The agreement ID is hardcoded in the endpoint, so it will always return the same agreement.
318
+ """
319
+ data = await self._api._default_request("GET", "/member/agreements/9d98fb27-0f00-4598-ad08-5b1655a59af6")
320
+ return LatestAgreement(**data["data"])
321
+
322
+ async def get_studio_services(self, studio_uuid: str | None = None) -> StudioServiceList:
323
+ """Get the services available at a specific studio. If no studio UUID is provided, the member's home studio
324
+ will be used.
325
+
326
+ Args:
327
+ studio_uuid (str): The studio UUID to get services for. Default is None, which will use the member's home\
328
+ studio.
329
+
330
+ Returns:
331
+ StudioServiceList: The services available at the studio.
332
+ """
333
+ studio_uuid = studio_uuid or self._api.home_studio.studio_uuid
334
+ data = await self._api._default_request("GET", f"/member/studios/{studio_uuid}/services")
335
+ return StudioServiceList(data=data["data"])
336
+
337
+ # the below do not return any data for me, so I can't test them
338
+
339
+ async def _get_member_services(self, active_only: bool = True) -> typing.Any:
340
+ """Get the member's services.
341
+
342
+ Args:
343
+ active_only (bool): Whether to only include active services. Default is True.
344
+
345
+ Returns:
346
+ Any: The member's service
347
+ ."""
348
+ active_only_str = "true" if active_only else "false"
349
+ data = await self._api._default_request(
350
+ "GET", f"/member/members/{self._member_id}/services", params={"activeOnly": active_only_str}
351
+ )
352
+ return data
353
+
354
+ async def _get_aspire_data(self, datetime: str | None = None, unit: str | None = None) -> typing.Any:
355
+ """Get data from the member's aspire wearable.
356
+
357
+ Note: I don't have an aspire wearable, so I can't test this.
358
+
359
+ Args:
360
+ datetime (str | None): The date and time to get data for. Default is None.
361
+ unit (str | None): The measurement unit. Default is None.
362
+
363
+ Returns:
364
+ Any: The member's aspire data.
365
+ """
366
+ params = {"datetime": datetime, "unit": unit}
367
+
368
+ data = self._api._default_request("GET", f"/member/wearables/{self._member_id}/wearable-daily", params=params)
369
+ return data
370
+
371
+ async def _get_body_composition_list(self) -> typing.Any:
372
+ """Get the member's body composition list.
373
+
374
+ Note: I don't have body composition data, so I can't test this.
375
+
376
+ Returns:
377
+ Any: The member's body composition list.
378
+ """
379
+ data = await self._api._default_request("GET", f"/member/members/{self._member_uuid}/body-composition")
380
+ return data