Skip to content

Commit 7bb636b

Browse files
Generate cost
1 parent d14550d commit 7bb636b

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

services/cost/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4407196dbbef4e53e6798809e856725cbc84ae05
1+
d5bd75f47f4b364fa6f71663efb4ba41ec703ac8

services/cost/src/stackit/cost/models/detailed_service_cost.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Field,
2424
StrictFloat,
2525
StrictInt,
26+
StrictStr,
2627
)
2728
from pydantic_core import to_jsonable_python
2829
from typing_extensions import Annotated, Self
@@ -56,6 +57,10 @@ class DetailedServiceCost(BaseModel):
5657
alias="totalDiscount",
5758
)
5859
total_quantity: StrictInt = Field(description="Total quantity", alias="totalQuantity")
60+
total_quantity_decimal: StrictStr = Field(
61+
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. ",
62+
alias="totalQuantityDecimal",
63+
)
5964
unit_label: Annotated[str, Field(min_length=1, strict=True, max_length=64)] = Field(
6065
description="Label for unit", alias="unitLabel"
6166
)
@@ -67,6 +72,7 @@ class DetailedServiceCost(BaseModel):
6772
"totalCharge",
6873
"totalDiscount",
6974
"totalQuantity",
75+
"totalQuantityDecimal",
7076
"unitLabel",
7177
]
7278

@@ -138,6 +144,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
138144
"totalCharge": obj.get("totalCharge"),
139145
"totalDiscount": obj.get("totalDiscount"),
140146
"totalQuantity": obj.get("totalQuantity"),
147+
"totalQuantityDecimal": obj.get("totalQuantityDecimal"),
141148
"unitLabel": obj.get("unitLabel"),
142149
}
143150
)

services/cost/src/stackit/cost/models/report_data.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Field,
2424
StrictFloat,
2525
StrictInt,
26+
StrictStr,
2627
)
2728
from pydantic_core import to_jsonable_python
2829
from typing_extensions import Self
@@ -38,8 +39,12 @@ class ReportData(BaseModel):
3839
charge: Union[StrictFloat, StrictInt] = Field(description="Charge, value in cents")
3940
discount: Union[StrictFloat, StrictInt] = Field(description="Discount, value in cents")
4041
quantity: StrictInt = Field(description="Quantity")
42+
quantity_decimal: StrictStr = Field(
43+
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. ",
44+
alias="quantityDecimal",
45+
)
4146
time_period: ReportDataTimePeriod = Field(alias="timePeriod")
42-
__properties: ClassVar[List[str]] = ["charge", "discount", "quantity", "timePeriod"]
47+
__properties: ClassVar[List[str]] = ["charge", "discount", "quantity", "quantityDecimal", "timePeriod"]
4348

4449
model_config = ConfigDict(
4550
validate_by_name=True,
@@ -97,6 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97102
"charge": obj.get("charge"),
98103
"discount": obj.get("discount"),
99104
"quantity": obj.get("quantity"),
105+
"quantityDecimal": obj.get("quantityDecimal"),
100106
"timePeriod": (
101107
ReportDataTimePeriod.from_dict(obj["timePeriod"]) if obj.get("timePeriod") is not None else None
102108
),

0 commit comments

Comments
 (0)