Skip to content

Commit cdfacda

Browse files
author
aman
committed
Update to BodyLoop API 0.15.4
1 parent 99d2142 commit cdfacda

81 files changed

Lines changed: 1257 additions & 1822 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/client/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ By default, when you're calling an HTTPS API it will attempt to verify that SSL
4747

4848
```python
4949
client = AuthenticatedClient(
50-
base_url="https://internal_api.example.com",
50+
base_url="https://internal_api.example.com",
5151
token="SuperSecretToken",
5252
verify_ssl="/path/to/certificate_bundle.pem",
5353
)
@@ -56,11 +56,7 @@ client = AuthenticatedClient(
5656
You can also disable certificate validation altogether, but beware that **this is a security risk**.
5757

5858
```python
59-
client = AuthenticatedClient(
60-
base_url="https://internal_api.example.com",
61-
token="SuperSecretToken",
62-
verify_ssl=False
63-
)
59+
client = AuthenticatedClient(base_url="https://internal_api.example.com", token="SuperSecretToken", verify_ssl=False)
6460
```
6561

6662
Things to know:
@@ -81,13 +77,16 @@ There are more settings on the generated `Client` class which let you control mo
8177
```python
8278
from client import Client
8379

80+
8481
def log_request(request):
8582
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
8683

84+
8785
def log_response(response):
8886
request = response.request
8987
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
9088

89+
9190
client = Client(
9291
base_url="https://api.example.com",
9392
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},

src/bodyloop_sdk/client/api/authentification/login_api_v2_authentification_token_post.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def _get_kwargs(
2424

2525
if not isinstance(body, Unset):
2626
_kwargs["data"] = body.to_dict()
27-
2827
headers["Content-Type"] = "application/x-www-form-urlencoded"
2928

3029
_kwargs["headers"] = headers

src/bodyloop_sdk/client/api/presets/import_preset_api_v2_presets_import_post.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def _get_kwargs(
2424

2525
_kwargs["files"] = body.to_multipart()
2626

27+
headers["Content-Type"] = "multipart/form-data; boundary=+++"
28+
2729
_kwargs["headers"] = headers
2830
return _kwargs
2931

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
import datetime
2+
from http import HTTPStatus
3+
from typing import Any
4+
5+
import httpx
6+
7+
from ... import errors
8+
from ...client import AuthenticatedClient, Client
9+
from ...models.get_event_count_api_v2_statistic_count_get_response_get_event_count_api_v2_statistic_count_get import (
10+
GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet,
11+
)
12+
from ...models.http_validation_error import HTTPValidationError
13+
from ...types import UNSET, Response, Unset
14+
15+
16+
def _get_kwargs(
17+
*,
18+
start: datetime.datetime | None | Unset = UNSET,
19+
end: datetime.datetime | None | Unset = UNSET,
20+
) -> dict[str, Any]:
21+
22+
params: dict[str, Any] = {}
23+
24+
json_start: None | str | Unset
25+
if isinstance(start, Unset):
26+
json_start = UNSET
27+
elif isinstance(start, datetime.datetime):
28+
json_start = start.isoformat()
29+
else:
30+
json_start = start
31+
params["start"] = json_start
32+
33+
json_end: None | str | Unset
34+
if isinstance(end, Unset):
35+
json_end = UNSET
36+
elif isinstance(end, datetime.datetime):
37+
json_end = end.isoformat()
38+
else:
39+
json_end = end
40+
params["end"] = json_end
41+
42+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
43+
44+
_kwargs: dict[str, Any] = {
45+
"method": "get",
46+
"url": "/api/v2/statistic/count",
47+
"params": params,
48+
}
49+
50+
return _kwargs
51+
52+
53+
def _parse_response(
54+
*, client: AuthenticatedClient | Client, response: httpx.Response
55+
) -> GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError | None:
56+
if response.status_code == 200:
57+
response_200 = GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet.from_dict(
58+
response.json()
59+
)
60+
61+
return response_200
62+
63+
if response.status_code == 422:
64+
response_422 = HTTPValidationError.from_dict(response.json())
65+
66+
return response_422
67+
68+
if client.raise_on_unexpected_status:
69+
raise errors.UnexpectedStatus(response.status_code, response.content)
70+
else:
71+
return None
72+
73+
74+
def _build_response(
75+
*, client: AuthenticatedClient | Client, response: httpx.Response
76+
) -> Response[GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError]:
77+
return Response(
78+
status_code=HTTPStatus(response.status_code),
79+
content=response.content,
80+
headers=response.headers,
81+
parsed=_parse_response(client=client, response=response),
82+
)
83+
84+
85+
def sync_detailed(
86+
*,
87+
client: AuthenticatedClient,
88+
start: datetime.datetime | None | Unset = UNSET,
89+
end: datetime.datetime | None | Unset = UNSET,
90+
) -> Response[GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError]:
91+
"""Get Event Count
92+
93+
Returns counts for all events, broken down by event, by event & status, and by event & status &
94+
info.
95+
`start`/`end` (i.e. 2026-01-01) add a `custom` window counting occurrences within that (inclusive)
96+
range
97+
98+
Args:
99+
start (datetime.datetime | None | Unset):
100+
end (datetime.datetime | None | Unset):
101+
102+
Raises:
103+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
104+
httpx.TimeoutException: If the request takes longer than Client.timeout.
105+
106+
Returns:
107+
Response[GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError]
108+
"""
109+
110+
kwargs = _get_kwargs(
111+
start=start,
112+
end=end,
113+
)
114+
115+
response = client.get_httpx_client().request(
116+
**kwargs,
117+
)
118+
119+
return _build_response(client=client, response=response)
120+
121+
122+
def sync(
123+
*,
124+
client: AuthenticatedClient,
125+
start: datetime.datetime | None | Unset = UNSET,
126+
end: datetime.datetime | None | Unset = UNSET,
127+
) -> GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError | None:
128+
"""Get Event Count
129+
130+
Returns counts for all events, broken down by event, by event & status, and by event & status &
131+
info.
132+
`start`/`end` (i.e. 2026-01-01) add a `custom` window counting occurrences within that (inclusive)
133+
range
134+
135+
Args:
136+
start (datetime.datetime | None | Unset):
137+
end (datetime.datetime | None | Unset):
138+
139+
Raises:
140+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141+
httpx.TimeoutException: If the request takes longer than Client.timeout.
142+
143+
Returns:
144+
GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError
145+
"""
146+
147+
return sync_detailed(
148+
client=client,
149+
start=start,
150+
end=end,
151+
).parsed
152+
153+
154+
async def asyncio_detailed(
155+
*,
156+
client: AuthenticatedClient,
157+
start: datetime.datetime | None | Unset = UNSET,
158+
end: datetime.datetime | None | Unset = UNSET,
159+
) -> Response[GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError]:
160+
"""Get Event Count
161+
162+
Returns counts for all events, broken down by event, by event & status, and by event & status &
163+
info.
164+
`start`/`end` (i.e. 2026-01-01) add a `custom` window counting occurrences within that (inclusive)
165+
range
166+
167+
Args:
168+
start (datetime.datetime | None | Unset):
169+
end (datetime.datetime | None | Unset):
170+
171+
Raises:
172+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
173+
httpx.TimeoutException: If the request takes longer than Client.timeout.
174+
175+
Returns:
176+
Response[GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError]
177+
"""
178+
179+
kwargs = _get_kwargs(
180+
start=start,
181+
end=end,
182+
)
183+
184+
response = await client.get_async_httpx_client().request(**kwargs)
185+
186+
return _build_response(client=client, response=response)
187+
188+
189+
async def asyncio(
190+
*,
191+
client: AuthenticatedClient,
192+
start: datetime.datetime | None | Unset = UNSET,
193+
end: datetime.datetime | None | Unset = UNSET,
194+
) -> GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError | None:
195+
"""Get Event Count
196+
197+
Returns counts for all events, broken down by event, by event & status, and by event & status &
198+
info.
199+
`start`/`end` (i.e. 2026-01-01) add a `custom` window counting occurrences within that (inclusive)
200+
range
201+
202+
Args:
203+
start (datetime.datetime | None | Unset):
204+
end (datetime.datetime | None | Unset):
205+
206+
Raises:
207+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
208+
httpx.TimeoutException: If the request takes longer than Client.timeout.
209+
210+
Returns:
211+
GetEventCountApiV2StatisticCountGetResponseGetEventCountApiV2StatisticCountGet | HTTPValidationError
212+
"""
213+
214+
return (
215+
await asyncio_detailed(
216+
client=client,
217+
start=start,
218+
end=end,
219+
)
220+
).parsed

src/bodyloop_sdk/client/api/system/tls_cert_update_api_v2_system_tls_certificate_put.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def _get_kwargs(
2525

2626
_kwargs["files"] = body.to_multipart()
2727

28+
headers["Content-Type"] = "multipart/form-data; boundary=+++"
29+
2830
_kwargs["headers"] = headers
2931
return _kwargs
3032

src/bodyloop_sdk/client/api/system_license/license_update_api_v2_system_license_update_post.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def _get_kwargs(
2525

2626
_kwargs["files"] = body.to_multipart()
2727

28+
headers["Content-Type"] = "multipart/form-data; boundary=+++"
29+
2830
_kwargs["headers"] = headers
2931
return _kwargs
3032

src/bodyloop_sdk/client/api/viatars/create_viatar_api_v2_viatars_post.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ def sync_detailed(
7070
Create a viatar (**C**RUD)
7171
7272
Args:
73-
body (ViatarData): Summary of ViatarData Example: {'note': 'A default viatar.',
74-
'observations': {}, 'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker':
75-
True, 'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight',
76-
'model': 'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000,
77-
'keep_images': False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d':
78-
{'detail': 'High', 'texture': True}, 'observations': {'weight': {}}, 'report': {'preset':
79-
'Default'}, 'title': ''}}.
73+
body (ViatarData): Example: {'note': 'A default viatar.', 'observations': {},
74+
'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker': True,
75+
'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight', 'model':
76+
'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000, 'keep_images':
77+
False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d': {'detail': 'High',
78+
'texture': True}, 'observations': {'weight': {}}, 'report': {'preset': 'Default'},
79+
'title': ''}}.
8080
8181
Raises:
8282
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -107,13 +107,13 @@ def sync(
107107
Create a viatar (**C**RUD)
108108
109109
Args:
110-
body (ViatarData): Summary of ViatarData Example: {'note': 'A default viatar.',
111-
'observations': {}, 'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker':
112-
True, 'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight',
113-
'model': 'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000,
114-
'keep_images': False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d':
115-
{'detail': 'High', 'texture': True}, 'observations': {'weight': {}}, 'report': {'preset':
116-
'Default'}, 'title': ''}}.
110+
body (ViatarData): Example: {'note': 'A default viatar.', 'observations': {},
111+
'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker': True,
112+
'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight', 'model':
113+
'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000, 'keep_images':
114+
False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d': {'detail': 'High',
115+
'texture': True}, 'observations': {'weight': {}}, 'report': {'preset': 'Default'},
116+
'title': ''}}.
117117
118118
Raises:
119119
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -139,13 +139,13 @@ async def asyncio_detailed(
139139
Create a viatar (**C**RUD)
140140
141141
Args:
142-
body (ViatarData): Summary of ViatarData Example: {'note': 'A default viatar.',
143-
'observations': {}, 'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker':
144-
True, 'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight',
145-
'model': 'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000,
146-
'keep_images': False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d':
147-
{'detail': 'High', 'texture': True}, 'observations': {'weight': {}}, 'report': {'preset':
148-
'Default'}, 'title': ''}}.
142+
body (ViatarData): Example: {'note': 'A default viatar.', 'observations': {},
143+
'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker': True,
144+
'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight', 'model':
145+
'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000, 'keep_images':
146+
False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d': {'detail': 'High',
147+
'texture': True}, 'observations': {'weight': {}}, 'report': {'preset': 'Default'},
148+
'title': ''}}.
149149
150150
Raises:
151151
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -174,13 +174,13 @@ async def asyncio(
174174
Create a viatar (**C**RUD)
175175
176176
Args:
177-
body (ViatarData): Summary of ViatarData Example: {'note': 'A default viatar.',
178-
'observations': {}, 'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker':
179-
True, 'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight',
180-
'model': 'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000,
181-
'keep_images': False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d':
182-
{'detail': 'High', 'texture': True}, 'observations': {'weight': {}}, 'report': {'preset':
183-
'Default'}, 'title': ''}}.
177+
body (ViatarData): Example: {'note': 'A default viatar.', 'observations': {},
178+
'parameters': {'analyzed_avatar_3d': {'orphaned_palpation_marker': True,
179+
'palp_snap_distance': 0.05, 'preset_id': -1}, 'avatar_3d': {'clothing': 'Tight', 'model':
180+
'No Model', 'reverse': False}, 'imageset_2d': {'exposure_time': 30000, 'keep_images':
181+
False, 'projector_brightness': 83, 'ring_brightness': 40}, 'mesh_3d': {'detail': 'High',
182+
'texture': True}, 'observations': {'weight': {}}, 'report': {'preset': 'Default'},
183+
'title': ''}}.
184184
185185
Raises:
186186
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

0 commit comments

Comments
 (0)