diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d0a76d..30d1d7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [v2.1.0](https://github.com/SebRut/pygrocy/tree/v2.1.0) (2024-04-23) + +**THIS IS WILL PROBABLY BE THE LAST pygrocy RELEASE, THE LIBRARY WILL GO INTO UNMAINTAINED STATE** + +[Full Changelog](https://github.com/SebRut/pygrocy/compare/v2.0.0...v2.1.0) + +**Closed issues:** + +- Add support for grocy api via reverse proxies [\#276](https://github.com/SebRut/pygrocy/issues/276) +- getting error when running code [\#274](https://github.com/SebRut/pygrocy/issues/274) +- Getting product by id fails if name\_plural is null [\#271](https://github.com/SebRut/pygrocy/issues/271) +- Support for Grocy 4.0 API [\#266](https://github.com/SebRut/pygrocy/issues/266) + +**Merged pull requests:** + +- Add amount field to ProductBarcode [\#278](https://github.com/SebRut/pygrocy/pull/278) ([looching](https://github.com/looching)) +- use value prop in delete API call [\#273](https://github.com/SebRut/pygrocy/pull/273) ([jeremy-green](https://github.com/jeremy-green)) +- Make plural name optional for Quantity Units [\#272](https://github.com/SebRut/pygrocy/pull/272) ([vorostamas](https://github.com/vorostamas)) + ## [v2.0.0](https://github.com/SebRut/pygrocy/tree/v2.0.0) (2023-08-17) [Full Changelog](https://github.com/SebRut/pygrocy/compare/v1.5.0...v2.0.0) diff --git a/README.md b/README.md index 8d420ce..decfda4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +**This project is de-facto unmaintained as haven't been using grocy for a while. Feel free to fork and create pygrocy2!** + # pygrocy [![Development Build Status](https://api.travis-ci.com/SebRut/pygrocy.svg?branch=develop)](https://travis-ci.com/SebRut/pygrocy) [![PyPI](https://img.shields.io/pypi/v/pygrocy.svg)](https://pypi.org/project/pygrocy/) diff --git a/pygrocy/data_models/product.py b/pygrocy/data_models/product.py index 62bc500..a962b8f 100644 --- a/pygrocy/data_models/product.py +++ b/pygrocy/data_models/product.py @@ -1,5 +1,5 @@ from datetime import datetime -from typing import List +from typing import List, Optional from pygrocy.base import DataModel from pygrocy.grocy_api_client import ( @@ -19,11 +19,16 @@ class ProductBarcode(DataModel): def __init__(self, data: ProductBarcodeData): self._barcode = data.barcode + self._amount = float(data.amount) if data.amount else None @property def barcode(self) -> str: return self._barcode + @property + def amount(self) -> Optional[float]: + return self._amount + class QuantityUnit(DataModel): def __init__(self, data: QuantityUnitData): diff --git a/pygrocy/grocy.py b/pygrocy/grocy.py index a7d9e6e..a1b3476 100644 --- a/pygrocy/grocy.py +++ b/pygrocy/grocy.py @@ -373,7 +373,7 @@ def update_generic(self, entity_type: EntityType, object_id: int, updated_data): ) def delete_generic(self, entity_type: EntityType, object_id: int): - return self._api_client.delete_generic(entity_type, object_id) + return self._api_client.delete_generic(entity_type.value, object_id) def get_generic_objects_for_type( self, entity_type: EntityType, query_filters: List[str] = None diff --git a/pygrocy/grocy_api_client.py b/pygrocy/grocy_api_client.py index c8dc1cd..2bb7098 100644 --- a/pygrocy/grocy_api_client.py +++ b/pygrocy/grocy_api_client.py @@ -71,7 +71,7 @@ class RecipeDetailsResponse(BaseModel): class QuantityUnitData(BaseModel): id: int name: str - name_plural: str + name_plural: Optional[str] = None description: Optional[str] = None row_created_timestamp: datetime @@ -161,6 +161,7 @@ class CurrentVolatilStockResponse(BaseModel): class ProductBarcodeData(BaseModel): barcode: str + amount: Optional[float] = None class ProductDetailsResponse(BaseModel): diff --git a/setup.py b/setup.py index b95e38b..29380d9 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pygrocy", - version="2.0.0", + version="2.1.0", author="Sebastian Rutofski", author_email="kontakt@sebastian-rutofski.de", description="",