add openapi-python-client generator + client
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.node_cart_configuration import NodeCartConfiguration
|
||||
from ..models.ticket_office_article_calculated_price import TicketOfficeArticleCalculatedPrice
|
||||
from ..models.ticket_office_node_configuration import TicketOfficeNodeConfiguration
|
||||
|
||||
|
||||
T = TypeVar("T", bound="TicketOfficeInfos")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class TicketOfficeInfos:
|
||||
"""Serializer for TicketOffice infos, equivalent to NodeSerializer for the BackOffice
|
||||
|
||||
Attributes:
|
||||
id (int):
|
||||
order (int): Local order between nodes that share the same parent
|
||||
parent_id (int):
|
||||
configuration (TicketOfficeNodeConfiguration): This is an extension of NodeConfigurationSerializer specific to
|
||||
the ticket office infos endpoint.
|
||||
It adds a field for extra info groups and a filter applied to this field.
|
||||
cart_configuration (NodeCartConfiguration): Serializer (read/write) for NodeCartConfiguration model
|
||||
article_calculated_price (TicketOfficeArticleCalculatedPrice):
|
||||
option_calculated_price (Union[None, str]): Retrieve the option article price from context. Return None if node
|
||||
is not in calculated_prices.
|
||||
children (list['TicketOfficeInfos']):
|
||||
internal_key (Union[Unset, str]):
|
||||
"""
|
||||
|
||||
id: int
|
||||
order: int
|
||||
parent_id: int
|
||||
configuration: "TicketOfficeNodeConfiguration"
|
||||
cart_configuration: "NodeCartConfiguration"
|
||||
article_calculated_price: "TicketOfficeArticleCalculatedPrice"
|
||||
option_calculated_price: Union[None, str]
|
||||
children: list["TicketOfficeInfos"]
|
||||
internal_key: Union[Unset, str] = 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
|
||||
|
||||
parent_id = self.parent_id
|
||||
|
||||
configuration = self.configuration.to_dict()
|
||||
|
||||
cart_configuration = self.cart_configuration.to_dict()
|
||||
|
||||
article_calculated_price = self.article_calculated_price.to_dict()
|
||||
|
||||
option_calculated_price: Union[None, str]
|
||||
option_calculated_price = self.option_calculated_price
|
||||
|
||||
children = []
|
||||
for children_item_data in self.children:
|
||||
children_item = children_item_data.to_dict()
|
||||
children.append(children_item)
|
||||
|
||||
internal_key = self.internal_key
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"id": id,
|
||||
"order": order,
|
||||
"parent_id": parent_id,
|
||||
"configuration": configuration,
|
||||
"cart_configuration": cart_configuration,
|
||||
"article_calculated_price": article_calculated_price,
|
||||
"option_calculated_price": option_calculated_price,
|
||||
"children": children,
|
||||
}
|
||||
)
|
||||
if internal_key is not UNSET:
|
||||
field_dict["internal_key"] = internal_key
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.node_cart_configuration import NodeCartConfiguration
|
||||
from ..models.ticket_office_article_calculated_price import TicketOfficeArticleCalculatedPrice
|
||||
from ..models.ticket_office_node_configuration import TicketOfficeNodeConfiguration
|
||||
|
||||
d = dict(src_dict)
|
||||
id = d.pop("id")
|
||||
|
||||
order = d.pop("order")
|
||||
|
||||
parent_id = d.pop("parent_id")
|
||||
|
||||
configuration = TicketOfficeNodeConfiguration.from_dict(d.pop("configuration"))
|
||||
|
||||
cart_configuration = NodeCartConfiguration.from_dict(d.pop("cart_configuration"))
|
||||
|
||||
article_calculated_price = TicketOfficeArticleCalculatedPrice.from_dict(d.pop("article_calculated_price"))
|
||||
|
||||
def _parse_option_calculated_price(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
option_calculated_price = _parse_option_calculated_price(d.pop("option_calculated_price"))
|
||||
|
||||
children = []
|
||||
_children = d.pop("children")
|
||||
for children_item_data in _children:
|
||||
children_item = TicketOfficeInfos.from_dict(children_item_data)
|
||||
|
||||
children.append(children_item)
|
||||
|
||||
internal_key = d.pop("internal_key", UNSET)
|
||||
|
||||
ticket_office_infos = cls(
|
||||
id=id,
|
||||
order=order,
|
||||
parent_id=parent_id,
|
||||
configuration=configuration,
|
||||
cart_configuration=cart_configuration,
|
||||
article_calculated_price=article_calculated_price,
|
||||
option_calculated_price=option_calculated_price,
|
||||
children=children,
|
||||
internal_key=internal_key,
|
||||
)
|
||||
|
||||
ticket_office_infos.additional_properties = d
|
||||
return ticket_office_infos
|
||||
|
||||
@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