Skip to content

Commit 3251fc1

Browse files
author
aman
committed
Update to API v0.15.17
1 parent 74de25a commit 3251fc1

88 files changed

Lines changed: 1955 additions & 693 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/bodyloop_sdk/bodyloop_client.py‎

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import json
2121
import logging
2222
from collections.abc import Awaitable, Callable
23-
from datetime import datetime, timedelta, timezone
23+
from datetime import UTC, datetime, timedelta
2424

2525
import httpx
2626

@@ -52,11 +52,9 @@ def expiry_of_jwt(token: str) -> datetime | None:
5252

5353
try:
5454
payload = token.split(".")[1]
55-
claims = json.loads(
56-
base64.urlsafe_b64decode(payload + "=" * (-len(payload) % 4))
57-
)
55+
claims = json.loads(base64.urlsafe_b64decode(payload + "=" * (-len(payload) % 4)))
5856

59-
return datetime.fromtimestamp(claims["exp"], tz=timezone.utc)
57+
return datetime.fromtimestamp(claims["exp"], tz=UTC)
6058

6159
except (IndexError, KeyError, TypeError, ValueError):
6260
return None
@@ -75,9 +73,7 @@ def __init__(self, client: "LoginAuthenticatedClient") -> None:
7573

7674
async def async_auth_flow(self, request: httpx.Request):
7775
token = self._client.token
78-
request.headers[self._client.auth_header_name] = (
79-
self._client.authorization(token)
80-
)
76+
request.headers[self._client.auth_header_name] = self._client.authorization(token)
8177

8278
response = yield request
8379

@@ -88,9 +84,7 @@ async def async_auth_flow(self, request: httpx.Request):
8884
# have been revoked, or the host may have restarted. Log in and retry.
8985
await self._client.refresh_token(stale_token=token)
9086

91-
request.headers[self._client.auth_header_name] = (
92-
self._client.authorization(self._client.token)
93-
)
87+
request.headers[self._client.auth_header_name] = self._client.authorization(self._client.token)
9488

9589
yield request
9690

@@ -130,7 +124,7 @@ def __init__(
130124
self.password = password
131125

132126
# No token yet, so it is expired as far as `token_is_fresh` cares.
133-
self.token_expires_at = datetime.min.replace(tzinfo=timezone.utc)
127+
self.token_expires_at = datetime.min.replace(tzinfo=UTC)
134128
self._login_lock = asyncio.Lock()
135129

136130
# Where tokens come from, in order of preference. Logging in with the
@@ -152,10 +146,7 @@ def authorization(self, token: str) -> str:
152146
def token_is_fresh(self) -> bool:
153147
"""Whether the current token is good for a while yet."""
154148

155-
return (
156-
datetime.now(timezone.utc) + TOKEN_REFRESH_MARGIN
157-
< self.token_expires_at
158-
)
149+
return datetime.now(UTC) + TOKEN_REFRESH_MARGIN < self.token_expires_at
159150

160151
async def ensure_token(self) -> None:
161152
"""Log in, unless the current token is still fresh."""
@@ -217,9 +208,7 @@ async def login(self) -> Token:
217208

218209
return token
219210

220-
raise RuntimeError(
221-
f"No token source worked — {'; '.join(problems)}"
222-
) from last_exception
211+
raise RuntimeError(f"No token source worked — {'; '.join(problems)}") from last_exception
223212

224213
async def login_with_password(self) -> Token:
225214
"""Request a token for the configured credentials."""
@@ -246,7 +235,7 @@ async def login_with_password(self) -> Token:
246235
def _apply_token(self, token: Token) -> None:
247236
self.token = token.access_token
248237
self.token_expires_at = expiry_of_jwt(token.access_token) or (
249-
datetime.now(timezone.utc) + timedelta(seconds=token.expires_in)
238+
datetime.now(UTC) + timedelta(seconds=token.expires_in)
250239
)
251240

252241
# The base class only stamps the header while building an httpx client,
@@ -265,9 +254,7 @@ async def __aenter__(self) -> "LoginAuthenticatedClient":
265254
return await super().__aenter__()
266255

267256
def __enter__(self) -> "LoginAuthenticatedClient":
268-
raise NotImplementedError(
269-
"Logging in is asynchronous — use 'async with' instead of 'with'."
270-
)
257+
raise NotImplementedError("Logging in is asynchronous — use 'async with' instead of 'with'.")
271258

272259

273260
# One client for the whole app: it holds the token and the connection pool,

‎src/bodyloop_sdk/client/api/markers_and_measures/create_angle_api_v2_viatars_viatar_id_angles_post.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def sync_detailed(
7676
body (Angle): Angle representation between three markers Example: {'angle_path':
7777
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
7878
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
79-
'to_marker': 'marker_b'}.
79+
'preference': 'primary', 'to_marker': 'marker_b'}.
8080
8181
Raises:
8282
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -111,7 +111,7 @@ def sync(
111111
body (Angle): Angle representation between three markers Example: {'angle_path':
112112
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
113113
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
114-
'to_marker': 'marker_b'}.
114+
'preference': 'primary', 'to_marker': 'marker_b'}.
115115
116116
Raises:
117117
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -141,7 +141,7 @@ async def asyncio_detailed(
141141
body (Angle): Angle representation between three markers Example: {'angle_path':
142142
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
143143
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
144-
'to_marker': 'marker_b'}.
144+
'preference': 'primary', 'to_marker': 'marker_b'}.
145145
146146
Raises:
147147
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -174,7 +174,7 @@ async def asyncio(
174174
body (Angle): Angle representation between three markers Example: {'angle_path':
175175
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
176176
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
177-
'to_marker': 'marker_b'}.
177+
'preference': 'primary', 'to_marker': 'marker_b'}.
178178
179179
Raises:
180180
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

‎src/bodyloop_sdk/client/api/markers_and_measures/create_crosssection_api_v2_viatars_viatar_id_crosssections_post.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def sync_detailed(
7575
viatar_id (int):
7676
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
7777
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
78-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
78+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
79+
'convex'}.
7980
8081
Raises:
8182
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -109,7 +110,8 @@ def sync(
109110
viatar_id (int):
110111
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
111112
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
112-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
113+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
114+
'convex'}.
113115
114116
Raises:
115117
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -138,7 +140,8 @@ async def asyncio_detailed(
138140
viatar_id (int):
139141
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
140142
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
141-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
143+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
144+
'convex'}.
142145
143146
Raises:
144147
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -170,7 +173,8 @@ async def asyncio(
170173
viatar_id (int):
171174
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
172175
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
173-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
176+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
177+
'convex'}.
174178
175179
Raises:
176180
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

‎src/bodyloop_sdk/client/api/markers_and_measures/create_distance_api_v2_viatars_viatar_id_distances_post.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def sync_detailed(
7575
viatar_id (int):
7676
body (Distance): Distance representation between two markers Example: {'distance_path':
7777
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
78-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
78+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
79+
'to_marker': 'marker_b'}.
7980
8081
Raises:
8182
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -109,7 +110,8 @@ def sync(
109110
viatar_id (int):
110111
body (Distance): Distance representation between two markers Example: {'distance_path':
111112
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
112-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
113+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
114+
'to_marker': 'marker_b'}.
113115
114116
Raises:
115117
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -138,7 +140,8 @@ async def asyncio_detailed(
138140
viatar_id (int):
139141
body (Distance): Distance representation between two markers Example: {'distance_path':
140142
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
141-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
143+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
144+
'to_marker': 'marker_b'}.
142145
143146
Raises:
144147
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -170,7 +173,8 @@ async def asyncio(
170173
viatar_id (int):
171174
body (Distance): Distance representation between two markers Example: {'distance_path':
172175
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
173-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
176+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
177+
'to_marker': 'marker_b'}.
174178
175179
Raises:
176180
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

‎src/bodyloop_sdk/client/api/markers_and_measures/update_angle_api_v2_viatars_viatar_id_angles_angle_path_patch.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def sync_detailed(
8080
body (Angle): Angle representation between three markers Example: {'angle_path':
8181
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
8282
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
83-
'to_marker': 'marker_b'}.
83+
'preference': 'primary', 'to_marker': 'marker_b'}.
8484
8585
Raises:
8686
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -118,7 +118,7 @@ def sync(
118118
body (Angle): Angle representation between three markers Example: {'angle_path':
119119
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
120120
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
121-
'to_marker': 'marker_b'}.
121+
'preference': 'primary', 'to_marker': 'marker_b'}.
122122
123123
Raises:
124124
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -151,7 +151,7 @@ async def asyncio_detailed(
151151
body (Angle): Angle representation between three markers Example: {'angle_path':
152152
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
153153
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
154-
'to_marker': 'marker_b'}.
154+
'preference': 'primary', 'to_marker': 'marker_b'}.
155155
156156
Raises:
157157
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -187,7 +187,7 @@ async def asyncio(
187187
body (Angle): Angle representation between three markers Example: {'angle_path':
188188
'custom.path.M', 'at_marker': 'marker_o', 'from_marker': 'marker_a', 'hidden': False,
189189
'key_external': '', 'label': 'Descriptive label', 'note': 'Meaningful description...',
190-
'to_marker': 'marker_b'}.
190+
'preference': 'primary', 'to_marker': 'marker_b'}.
191191
192192
Raises:
193193
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

‎src/bodyloop_sdk/client/api/markers_and_measures/update_crosssection_api_v2_viatars_viatar_id_crosssections_crosssection_path_patch.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def sync_detailed(
7979
crosssection_path (str):
8080
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
8181
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
82-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
82+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
83+
'convex'}.
8384
8485
Raises:
8586
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -116,7 +117,8 @@ def sync(
116117
crosssection_path (str):
117118
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
118119
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
119-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
120+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
121+
'convex'}.
120122
121123
Raises:
122124
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -148,7 +150,8 @@ async def asyncio_detailed(
148150
crosssection_path (str):
149151
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
150152
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
151-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
153+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
154+
'convex'}.
152155
153156
Raises:
154157
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -183,7 +186,8 @@ async def asyncio(
183186
crosssection_path (str):
184187
body (Crosssection): Crosssection representation at one marker Example: {'at_marker':
185188
'marker_a', 'crosssection_path': 'custom.path.M', 'hidden': False, 'key_external': '',
186-
'label': 'Descriptive label', 'note': 'Meaningful description...'}.
189+
'label': 'Descriptive label', 'note': 'Meaningful description...', 'preference':
190+
'convex'}.
187191
188192
Raises:
189193
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

‎src/bodyloop_sdk/client/api/markers_and_measures/update_distance_api_v2_viatars_viatar_id_distances_distance_path_patch.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def sync_detailed(
7979
distance_path (str):
8080
body (Distance): Distance representation between two markers Example: {'distance_path':
8181
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
82-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
82+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
83+
'to_marker': 'marker_b'}.
8384
8485
Raises:
8586
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -116,7 +117,8 @@ def sync(
116117
distance_path (str):
117118
body (Distance): Distance representation between two markers Example: {'distance_path':
118119
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
119-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
120+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
121+
'to_marker': 'marker_b'}.
120122
121123
Raises:
122124
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -148,7 +150,8 @@ async def asyncio_detailed(
148150
distance_path (str):
149151
body (Distance): Distance representation between two markers Example: {'distance_path':
150152
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
151-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
153+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
154+
'to_marker': 'marker_b'}.
152155
153156
Raises:
154157
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -183,7 +186,8 @@ async def asyncio(
183186
distance_path (str):
184187
body (Distance): Distance representation between two markers Example: {'distance_path':
185188
'custom.path.M', 'from_marker': 'marker_a', 'hidden': False, 'key_external': '', 'label':
186-
'Descriptive label', 'note': 'Meaningful description...', 'to_marker': 'marker_b'}.
189+
'Descriptive label', 'note': 'Meaningful description...', 'preference': 'linear',
190+
'to_marker': 'marker_b'}.
187191
188192
Raises:
189193
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

0 commit comments

Comments
 (0)