add openapi-python-client generator + client
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..models.selected_node_status_enum import SelectedNodeStatusEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="SelectedNode")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class SelectedNode:
|
||||
"""Serializer for SelectedNode model
|
||||
|
||||
Attributes:
|
||||
id (int):
|
||||
order (int): Local order between nodes that share the same parent
|
||||
basket (int):
|
||||
parent_id (int):
|
||||
configuration_id (int):
|
||||
price (float):
|
||||
price_display (str):
|
||||
is_article (Union[Unset, bool]):
|
||||
status (Union[Unset, SelectedNodeStatusEnum]): * `new` - New
|
||||
* `payment_in_progress` - Payment in progress
|
||||
* `validated` - Validated
|
||||
* `edition_in_progress` - Edition in progress
|
||||
* `refunded` - Refunded
|
||||
"""
|
||||
|
||||
id: int
|
||||
order: int
|
||||
basket: int
|
||||
parent_id: int
|
||||
configuration_id: int
|
||||
price: float
|
||||
price_display: str
|
||||
is_article: Union[Unset, bool] = UNSET
|
||||
status: Union[Unset, SelectedNodeStatusEnum] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
order = self.order
|
||||
|
||||
basket = self.basket
|
||||
|
||||
parent_id = self.parent_id
|
||||
|
||||
configuration_id = self.configuration_id
|
||||
|
||||
price = self.price
|
||||
|
||||
price_display = self.price_display
|
||||
|
||||
is_article = self.is_article
|
||||
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"id": id,
|
||||
"order": order,
|
||||
"basket": basket,
|
||||
"parent_id": parent_id,
|
||||
"configuration_id": configuration_id,
|
||||
"price": price,
|
||||
"price_display": price_display,
|
||||
}
|
||||
)
|
||||
if is_article is not UNSET:
|
||||
field_dict["is_article"] = is_article
|
||||
if status is not UNSET:
|
||||
field_dict["status"] = status
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
id = d.pop("id")
|
||||
|
||||
order = d.pop("order")
|
||||
|
||||
basket = d.pop("basket")
|
||||
|
||||
parent_id = d.pop("parent_id")
|
||||
|
||||
configuration_id = d.pop("configuration_id")
|
||||
|
||||
price = d.pop("price")
|
||||
|
||||
price_display = d.pop("price_display")
|
||||
|
||||
is_article = d.pop("is_article", UNSET)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, SelectedNodeStatusEnum]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = SelectedNodeStatusEnum(_status)
|
||||
|
||||
selected_node = cls(
|
||||
id=id,
|
||||
order=order,
|
||||
basket=basket,
|
||||
parent_id=parent_id,
|
||||
configuration_id=configuration_id,
|
||||
price=price,
|
||||
price_display=price_display,
|
||||
is_article=is_article,
|
||||
status=status,
|
||||
)
|
||||
|
||||
selected_node.additional_properties = d
|
||||
return selected_node
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
Reference in New Issue
Block a user