Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bendikrb committed Nov 6, 2023
1 parent 0c1c9ec commit 6462ccd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions kassalappy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ async def get_shopping_lists(self):
"""Get shopping lists."""
return await self.execute(f"shopping-lists")

async def get_shopping_list(self, list_id: int):
async def get_shopping_list(self, list_id: int, include_items: bool = False):
"""Get a shopping list."""
return await self.execute(f"shopping-lists/{list_id}")
params = {}
if include_items:
params["include"] = "items"
return await self.execute(f"shopping-lists/{list_id}", params=params)

async def create_shopping_list(self, title: str):
"""Create a new shopping list."""
Expand All @@ -98,7 +101,7 @@ async def update_shopping_list(self, list_id: int, title: str):

async def get_shopping_list_items(self, list_id: int):
"""Shorthand method to get all items from a shopping list."""
shopping_list = await self.get_shopping_list(list_id)
shopping_list = await self.get_shopping_list(list_id, include_items=True)
return shopping_list.get("items", [])

async def add_shopping_list_item(self, list_id: int, text: str, product_id: int | None = None):
Expand Down
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 = "kassalappy"
version = "0.4.0"
version = "0.5.0"
description = ""
authors = ["Bendik R. Brenne <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 6462ccd

Please sign in to comment.