Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/cost/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4407196dbbef4e53e6798809e856725cbc84ae05
d5bd75f47f4b364fa6f71663efb4ba41ec703ac8
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Field,
StrictFloat,
StrictInt,
StrictStr,
)
from pydantic_core import to_jsonable_python
from typing_extensions import Annotated, Self
Expand Down Expand Up @@ -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"
)
Expand All @@ -67,6 +72,7 @@ class DetailedServiceCost(BaseModel):
"totalCharge",
"totalDiscount",
"totalQuantity",
"totalQuantityDecimal",
"unitLabel",
]

Expand Down Expand Up @@ -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"),
}
)
Expand Down
8 changes: 7 additions & 1 deletion services/cost/src/stackit/cost/models/report_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Field,
StrictFloat,
StrictInt,
StrictStr,
)
from pydantic_core import to_jsonable_python
from typing_extensions import Self
Expand All @@ -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,
Expand Down Expand Up @@ -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
),
Expand Down
Loading