diff --git a/CHANGELOG.md b/CHANGELOG.md index 16f27086b..17db7b366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ - [v0.3.0](services/cost/CHANGELOG.md#v030) - **Chore:** Bump minimum Python version to 3.10 - **Chore:** Update dependencies + - [v0.4.0](services/cost/CHANGELOG.md#v040) + - **Feature:** Add attribute `total_quantity_decimal` to `DetailedServiceCost` model class + - **Feature:** Add attribute `quantity_decimal` to `ReportData` model class - `dns` - [v0.7.0](services/dns/CHANGELOG.md#v070) - **Chore:** Bump minimum Python version to 3.10 diff --git a/services/cost/CHANGELOG.md b/services/cost/CHANGELOG.md index ed40ae2e0..689a708ca 100644 --- a/services/cost/CHANGELOG.md +++ b/services/cost/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.4.0 +- **Feature:** Add attribute `total_quantity_decimal` to `DetailedServiceCost` model class +- **Feature:** Add attribute `quantity_decimal` to `ReportData` model class + ## v0.3.0 - **Chore:** Bump minimum Python version to 3.10 - **Chore:** Update dependencies diff --git a/services/cost/oas_commit b/services/cost/oas_commit index c08a6770d..b687a3969 100644 --- a/services/cost/oas_commit +++ b/services/cost/oas_commit @@ -1 +1 @@ -4407196dbbef4e53e6798809e856725cbc84ae05 +f22dd14374388602d895c8892b3e5b110dc16582 diff --git a/services/cost/pyproject.toml b/services/cost/pyproject.toml index 6a0b54c9d..efe6c5bbf 100644 --- a/services/cost/pyproject.toml +++ b/services/cost/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "stackit-cost" -version = "v0.3.0" +version = "v0.4.0" description = "STACKIT Cost API" authors = [{name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud"}] requires-python = ">=3.10,<4.0" diff --git a/services/cost/src/stackit/cost/models/detailed_service_cost.py b/services/cost/src/stackit/cost/models/detailed_service_cost.py index 5bdc5c8a3..a79e3ab00 100644 --- a/services/cost/src/stackit/cost/models/detailed_service_cost.py +++ b/services/cost/src/stackit/cost/models/detailed_service_cost.py @@ -23,6 +23,7 @@ Field, StrictFloat, StrictInt, + StrictStr, ) from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -56,6 +57,10 @@ class DetailedServiceCost(BaseModel): alias="totalDiscount", ) total_quantity: StrictInt = Field(description="Total quantity", alias="totalQuantity") + total_quantity_decimal: StrictStr = Field( + description="Total quantity in decimal format, returned as string to preserve precision. NOTE: This field will be removed in future versions and `totalQuantity` will become a decimal. ", + alias="totalQuantityDecimal", + ) unit_label: Annotated[str, Field(min_length=1, strict=True, max_length=64)] = Field( description="Label for unit", alias="unitLabel" ) @@ -67,6 +72,7 @@ class DetailedServiceCost(BaseModel): "totalCharge", "totalDiscount", "totalQuantity", + "totalQuantityDecimal", "unitLabel", ] @@ -138,6 +144,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "totalCharge": obj.get("totalCharge"), "totalDiscount": obj.get("totalDiscount"), "totalQuantity": obj.get("totalQuantity"), + "totalQuantityDecimal": obj.get("totalQuantityDecimal"), "unitLabel": obj.get("unitLabel"), } ) diff --git a/services/cost/src/stackit/cost/models/report_data.py b/services/cost/src/stackit/cost/models/report_data.py index 309f2fa93..85cfa2519 100644 --- a/services/cost/src/stackit/cost/models/report_data.py +++ b/services/cost/src/stackit/cost/models/report_data.py @@ -23,6 +23,7 @@ Field, StrictFloat, StrictInt, + StrictStr, ) from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -38,8 +39,12 @@ class ReportData(BaseModel): charge: Union[StrictFloat, StrictInt] = Field(description="Charge, value in cents") discount: Union[StrictFloat, StrictInt] = Field(description="Discount, value in cents") quantity: StrictInt = Field(description="Quantity") + quantity_decimal: StrictStr = Field( + description="Quantity in decimal format, returned as string to preserve precision. NOTE: This field will be removed in future versions and `totalQuantity` will become a decimal. ", + alias="quantityDecimal", + ) time_period: ReportDataTimePeriod = Field(alias="timePeriod") - __properties: ClassVar[List[str]] = ["charge", "discount", "quantity", "timePeriod"] + __properties: ClassVar[List[str]] = ["charge", "discount", "quantity", "quantityDecimal", "timePeriod"] model_config = ConfigDict( validate_by_name=True, @@ -97,6 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "charge": obj.get("charge"), "discount": obj.get("discount"), "quantity": obj.get("quantity"), + "quantityDecimal": obj.get("quantityDecimal"), "timePeriod": ( ReportDataTimePeriod.from_dict(obj["timePeriod"]) if obj.get("timePeriod") is not None else None ),