Skip to content

Commit

Permalink
Add igg and ige
Browse files Browse the repository at this point in the history
  • Loading branch information
maitham committed Nov 11, 2021
1 parent ec7ab8e commit 92e8841
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "vital"
version = "0.3.3"
version = "0.3.4"
description = ""
authors = ["maitham <[email protected]>"]
license = "GNU"
Expand Down
2 changes: 1 addition & 1 deletion tests/api/e2e/test_workouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_workouts_returns_data(
def test_workouts_returns_data_for_provider(
test_client: Client, user_key: str, start_date, end_date
):
provider = "whoop"
provider = "oura"
data = test_client.Workouts.get(user_key, start_date, end_date, provider)
for datapoint in data["workouts"]:
assert datapoint["source"]["slug"] == provider
2 changes: 1 addition & 1 deletion vital/api/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get(
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
:param Optional[str] provider: Provider of data whoop, strava etc.
:param Optional[str] provider: Provider of data strava etc.
"""
return self.client.get(
f"/activity/{user_key}",
Expand Down
2 changes: 1 addition & 1 deletion vital/api/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get(
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
:param Optional[str] provider: Provider of data whoop, strava etc.
:param Optional[str] provider: Provider of data strava etc.
"""
return self.client.get(
f"/body/{user_key}",
Expand Down
2 changes: 1 addition & 1 deletion vital/api/provider_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get(
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
:param Optional[str] provider: Provider of data whoop, strava etc.
:param Optional[str] provider: Provider of data strava etc.
:param Optional[str] data_type: activity | sleep | body | workouts
"""
return self.client.get(
Expand Down
65 changes: 63 additions & 2 deletions vital/api/vitals.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def glucose(
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
:param Optional[str] provider: Provider of data whoop, strava etc.
:param Optional[str] provider: Provider of data
"""
return self.client.get(
f"/vitals/glucose/{user_key}",
Expand All @@ -29,6 +29,29 @@ def glucose(
},
)

def hba1c(
self,
user_key: str,
start_date: str,
end_date: str,
provider: Optional[str] = "",
) -> Mapping[str, List[Mapping]]:
"""
Get hba1c value API
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
:param Optional[str] provider: Provider of data
"""
return self.client.get(
f"/vitals/hba1c/{user_key}",
params={
"start_date": start_date,
"end_date": end_date,
"provider": provider,
},
)

def cholesterol(
self,
type: str,
Expand All @@ -42,7 +65,7 @@ def cholesterol(
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
:param Optional[str] provider: Provider of data whoop, strava etc.
:param Optional[str] provider: Provider of data
"""
return self.client.get(
f"/vitals/cholesterol/{type}/{user_key}",
Expand All @@ -52,3 +75,41 @@ def cholesterol(
"provider": provider,
},
)

def ige(
self,
user_key: str,
start_date: str,
end_date: str,
provider: Optional[str] = "",
) -> Mapping[str, List[Mapping]]:
"""
Get glucose value API
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
"""
return self.client.get(
f"/vitals/ige/{user_key}",
params={"start_date": start_date, "end_date": end_date},
)

def igg(
self,
user_key: str,
start_date: str,
end_date: str,
) -> Mapping[str, List[Mapping]]:
"""
Get glucose value API
:param str user_key: users key
:param str start_date: date in ISO format
:param str end_date: date in ISO format
"""
return self.client.get(
f"/vitals/igg/{user_key}",
params={
"start_date": start_date,
"end_date": end_date,
},
)

0 comments on commit 92e8841

Please sign in to comment.