Skip to content

Commit 6622039

Browse files
committed
Release 1.1.0
1 parent 0c74e80 commit 6622039

24 files changed

Lines changed: 210 additions & 74 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ client.integrations.fetch()
3535

3636
## Async Client
3737

38-
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
38+
The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
3939

4040
```python
4141
import asyncio

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "terra-python"
33

44
[tool.poetry]
55
name = "terra-python"
6-
version = "1.0.13"
6+
version = "1.1.0"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,10 @@ client = Terra(
457457
dev_id="YOUR_DEV_ID",
458458
api_key="YOUR_API_KEY",
459459
)
460-
client.user.getinfoforuserid()
460+
client.user.getinfoforuserid(
461+
user_id="user_id",
462+
reference_id="reference_id",
463+
)
461464

462465
```
463466
</dd>
@@ -534,7 +537,10 @@ client = Terra(
534537
dev_id="YOUR_DEV_ID",
535538
api_key="YOUR_API_KEY",
536539
)
537-
client.user.getalluserids()
540+
client.user.getalluserids(
541+
page=1,
542+
per_page=1,
543+
)
538544

539545
```
540546
</dd>
@@ -686,6 +692,9 @@ client = Terra(
686692
client.activity.fetch(
687693
user_id="user_id",
688694
start_date=1,
695+
end_date=1,
696+
to_webhook=True,
697+
with_samples=True,
689698
)
690699

691700
```
@@ -726,7 +735,7 @@ client.activity.fetch(
726735
<dl>
727736
<dd>
728737

729-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
738+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
730739

731740
</dd>
732741
</dl>
@@ -871,6 +880,7 @@ client = Terra(
871880
)
872881
client.athlete.fetch(
873882
user_id="user_id",
883+
to_webhook=True,
874884
)
875885

876886
```
@@ -895,7 +905,7 @@ client.athlete.fetch(
895905
<dl>
896906
<dd>
897907

898-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
908+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
899909

900910
</dd>
901911
</dl>
@@ -952,6 +962,9 @@ client = Terra(
952962
client.body.fetch(
953963
user_id="user_id",
954964
start_date=1,
965+
end_date=1,
966+
to_webhook=True,
967+
with_samples=True,
955968
)
956969

957970
```
@@ -992,7 +1005,7 @@ client.body.fetch(
9921005
<dl>
9931006
<dd>
9941007

995-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
1008+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
9961009

9971010
</dd>
9981011
</dl>
@@ -1214,6 +1227,9 @@ client = Terra(
12141227
client.daily.fetch(
12151228
user_id="user_id",
12161229
start_date=1,
1230+
end_date=1,
1231+
to_webhook=True,
1232+
with_samples=True,
12171233
)
12181234

12191235
```
@@ -1254,7 +1270,7 @@ client.daily.fetch(
12541270
<dl>
12551271
<dd>
12561272

1257-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
1273+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
12581274

12591275
</dd>
12601276
</dl>
@@ -1319,6 +1335,9 @@ client = Terra(
13191335
client.menstruation.fetch(
13201336
user_id="user_id",
13211337
start_date=1,
1338+
end_date=1,
1339+
to_webhook=True,
1340+
with_samples=True,
13221341
)
13231342

13241343
```
@@ -1359,7 +1378,7 @@ client.menstruation.fetch(
13591378
<dl>
13601379
<dd>
13611380

1362-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
1381+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
13631382

13641383
</dd>
13651384
</dl>
@@ -1424,6 +1443,9 @@ client = Terra(
14241443
client.nutrition.fetch(
14251444
user_id="user_id",
14261445
start_date=1,
1446+
end_date=1,
1447+
to_webhook=True,
1448+
with_samples=True,
14271449
)
14281450

14291451
```
@@ -1464,7 +1486,7 @@ client.nutrition.fetch(
14641486
<dl>
14651487
<dd>
14661488

1467-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
1489+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
14681490

14691491
</dd>
14701492
</dl>
@@ -1686,6 +1708,9 @@ client = Terra(
16861708
client.sleep.fetch(
16871709
user_id="user_id",
16881710
start_date=1,
1711+
end_date=1,
1712+
to_webhook=True,
1713+
with_samples=True,
16891714
)
16901715

16911716
```
@@ -1726,7 +1751,7 @@ client.sleep.fetch(
17261751
<dl>
17271752
<dd>
17281753

1729-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
1754+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
17301755

17311756
</dd>
17321757
</dl>
@@ -1791,6 +1816,8 @@ client = Terra(
17911816
client.plannedworkout.fetch(
17921817
user_id="user_id",
17931818
start_date=1,
1819+
end_date=1,
1820+
to_webhook=True,
17941821
)
17951822

17961823
```
@@ -1831,7 +1858,7 @@ client.plannedworkout.fetch(
18311858
<dl>
18321859
<dd>
18331860

1834-
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
1861+
**to_webhook:** `typing.Optional[bool]` — Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
18351862

18361863
</dd>
18371864
</dl>
@@ -1885,6 +1912,7 @@ client = Terra(
18851912
api_key="YOUR_API_KEY",
18861913
)
18871914
client.plannedworkout.write(
1915+
user_id="user_id",
18881916
data=[PlannedWorkout()],
18891917
)
18901918

@@ -1902,6 +1930,14 @@ client.plannedworkout.write(
19021930
<dl>
19031931
<dd>
19041932

1933+
**user_id:** `str` — Terra user ID (UUID format) to retrieve data for
1934+
1935+
</dd>
1936+
</dl>
1937+
1938+
<dl>
1939+
<dd>
1940+
19051941
**data:** `typing.Sequence[PlannedWorkout]` — PlannedWorkout entry to post to data provider
19061942

19071943
</dd>
@@ -2096,7 +2132,9 @@ client = Terra(
20962132
dev_id="YOUR_DEV_ID",
20972133
api_key="YOUR_API_KEY",
20982134
)
2099-
client.integrations.detailedfetch()
2135+
client.integrations.detailedfetch(
2136+
sdk=True,
2137+
)
21002138

21012139
```
21022140
</dd>

src/terra/__init__.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
"AsyncTerra": ".client",
2626
"Terra": ".client",
2727
"__version__": ".version",
28-
"activity": ".",
29-
"athlete": ".",
30-
"authentication": ".",
31-
"body": ".",
32-
"daily": ".",
33-
"integrations": ".",
34-
"menstruation": ".",
35-
"nutrition": ".",
36-
"plannedworkout": ".",
37-
"sleep": ".",
38-
"user": ".",
28+
"activity": ".activity",
29+
"athlete": ".athlete",
30+
"authentication": ".authentication",
31+
"body": ".body",
32+
"daily": ".daily",
33+
"integrations": ".integrations",
34+
"menstruation": ".menstruation",
35+
"nutrition": ".nutrition",
36+
"plannedworkout": ".plannedworkout",
37+
"sleep": ".sleep",
38+
"user": ".user",
3939
}
4040

4141

@@ -45,8 +45,10 @@ def __getattr__(attr_name: str) -> typing.Any:
4545
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
4646
try:
4747
module = import_module(module_name, __package__)
48-
result = getattr(module, attr_name)
49-
return result
48+
if module_name == f".{attr_name}":
49+
return module
50+
else:
51+
return getattr(module, attr_name)
5052
except ImportError as e:
5153
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
5254
except AttributeError as e:

src/terra/activity/client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def fetch(
5555
End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)
5656
5757
to_webhook : typing.Optional[bool]
58-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
58+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
5959
6060
with_samples : typing.Optional[bool]
6161
Boolean flag specifying whether to include detailed samples in the returned payload (default: false)
@@ -79,6 +79,9 @@ def fetch(
7979
client.activity.fetch(
8080
user_id="user_id",
8181
start_date=1,
82+
end_date=1,
83+
to_webhook=True,
84+
with_samples=True,
8285
)
8386
"""
8487
_response = self._raw_client.fetch(
@@ -176,7 +179,7 @@ async def fetch(
176179
End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)
177180
178181
to_webhook : typing.Optional[bool]
179-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
182+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
180183
181184
with_samples : typing.Optional[bool]
182185
Boolean flag specifying whether to include detailed samples in the returned payload (default: false)
@@ -205,6 +208,9 @@ async def main() -> None:
205208
await client.activity.fetch(
206209
user_id="user_id",
207210
start_date=1,
211+
end_date=1,
212+
to_webhook=True,
213+
with_samples=True,
208214
)
209215
210216

src/terra/activity/raw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def fetch(
5151
End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)
5252
5353
to_webhook : typing.Optional[bool]
54-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
54+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
5555
5656
with_samples : typing.Optional[bool]
5757
Boolean flag specifying whether to include detailed samples in the returned payload (default: false)
@@ -224,7 +224,7 @@ async def fetch(
224224
End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)
225225
226226
to_webhook : typing.Optional[bool]
227-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
227+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
228228
229229
with_samples : typing.Optional[bool]
230230
Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

src/terra/athlete/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def fetch(
3939
Terra user ID (UUID format) to retrieve data for
4040
4141
to_webhook : typing.Optional[bool]
42-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
42+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
4343
4444
request_options : typing.Optional[RequestOptions]
4545
Request-specific configuration.
@@ -59,6 +59,7 @@ def fetch(
5959
)
6060
client.athlete.fetch(
6161
user_id="user_id",
62+
to_webhook=True,
6263
)
6364
"""
6465
_response = self._raw_client.fetch(user_id=user_id, to_webhook=to_webhook, request_options=request_options)
@@ -96,7 +97,7 @@ async def fetch(
9697
Terra user ID (UUID format) to retrieve data for
9798
9899
to_webhook : typing.Optional[bool]
99-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
100+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
100101
101102
request_options : typing.Optional[RequestOptions]
102103
Request-specific configuration.
@@ -121,6 +122,7 @@ async def fetch(
121122
async def main() -> None:
122123
await client.athlete.fetch(
123124
user_id="user_id",
125+
to_webhook=True,
124126
)
125127
126128

src/terra/athlete/raw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def fetch(
3434
Terra user ID (UUID format) to retrieve data for
3535
3636
to_webhook : typing.Optional[bool]
37-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
37+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
3838
3939
request_options : typing.Optional[RequestOptions]
4040
Request-specific configuration.
@@ -122,7 +122,7 @@ async def fetch(
122122
Terra user ID (UUID format) to retrieve data for
123123
124124
to_webhook : typing.Optional[bool]
125-
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: false)
125+
Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)
126126
127127
request_options : typing.Optional[RequestOptions]
128128
Request-specific configuration.

0 commit comments

Comments
 (0)