add openapi-python-client generator + client
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .. import types
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="NodeLimit")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class NodeLimit:
|
||||
"""Serializer (read/write) for `NodeLimit` model
|
||||
|
||||
Attributes:
|
||||
event (int):
|
||||
event_id (int):
|
||||
id (int):
|
||||
key (str):
|
||||
label (str):
|
||||
maximum (int):
|
||||
order (int):
|
||||
global_order (int):
|
||||
node_configuration_ids (list[int]):
|
||||
is_deleted (Union[Unset, bool]):
|
||||
condition_id (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
event: int
|
||||
event_id: int
|
||||
id: int
|
||||
key: str
|
||||
label: str
|
||||
maximum: int
|
||||
order: int
|
||||
global_order: int
|
||||
node_configuration_ids: list[int]
|
||||
is_deleted: Union[Unset, bool] = UNSET
|
||||
condition_id: Union[Unset, int] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
event = self.event
|
||||
|
||||
event_id = self.event_id
|
||||
|
||||
id = self.id
|
||||
|
||||
key = self.key
|
||||
|
||||
label = self.label
|
||||
|
||||
maximum = self.maximum
|
||||
|
||||
order = self.order
|
||||
|
||||
global_order = self.global_order
|
||||
|
||||
node_configuration_ids = self.node_configuration_ids
|
||||
|
||||
is_deleted = self.is_deleted
|
||||
|
||||
condition_id = self.condition_id
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"event": event,
|
||||
"event_id": event_id,
|
||||
"id": id,
|
||||
"key": key,
|
||||
"label": label,
|
||||
"maximum": maximum,
|
||||
"order": order,
|
||||
"global_order": global_order,
|
||||
"node_configuration_ids": node_configuration_ids,
|
||||
}
|
||||
)
|
||||
if is_deleted is not UNSET:
|
||||
field_dict["is_deleted"] = is_deleted
|
||||
if condition_id is not UNSET:
|
||||
field_dict["condition_id"] = condition_id
|
||||
|
||||
return field_dict
|
||||
|
||||
def to_multipart(self) -> types.RequestFiles:
|
||||
files: types.RequestFiles = []
|
||||
|
||||
files.append(("event", (None, str(self.event).encode(), "text/plain")))
|
||||
|
||||
files.append(("event_id", (None, str(self.event_id).encode(), "text/plain")))
|
||||
|
||||
files.append(("id", (None, str(self.id).encode(), "text/plain")))
|
||||
|
||||
files.append(("key", (None, str(self.key).encode(), "text/plain")))
|
||||
|
||||
files.append(("label", (None, str(self.label).encode(), "text/plain")))
|
||||
|
||||
files.append(("maximum", (None, str(self.maximum).encode(), "text/plain")))
|
||||
|
||||
files.append(("order", (None, str(self.order).encode(), "text/plain")))
|
||||
|
||||
files.append(("global_order", (None, str(self.global_order).encode(), "text/plain")))
|
||||
|
||||
for node_configuration_ids_item_element in self.node_configuration_ids:
|
||||
files.append(
|
||||
("node_configuration_ids", (None, str(node_configuration_ids_item_element).encode(), "text/plain"))
|
||||
)
|
||||
|
||||
if not isinstance(self.is_deleted, Unset):
|
||||
files.append(("is_deleted", (None, str(self.is_deleted).encode(), "text/plain")))
|
||||
|
||||
if not isinstance(self.condition_id, Unset):
|
||||
files.append(("condition_id", (None, str(self.condition_id).encode(), "text/plain")))
|
||||
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
files.append((prop_name, (None, str(prop).encode(), "text/plain")))
|
||||
|
||||
return files
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
event = d.pop("event")
|
||||
|
||||
event_id = d.pop("event_id")
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
key = d.pop("key")
|
||||
|
||||
label = d.pop("label")
|
||||
|
||||
maximum = d.pop("maximum")
|
||||
|
||||
order = d.pop("order")
|
||||
|
||||
global_order = d.pop("global_order")
|
||||
|
||||
node_configuration_ids = cast(list[int], d.pop("node_configuration_ids"))
|
||||
|
||||
is_deleted = d.pop("is_deleted", UNSET)
|
||||
|
||||
condition_id = d.pop("condition_id", UNSET)
|
||||
|
||||
node_limit = cls(
|
||||
event=event,
|
||||
event_id=event_id,
|
||||
id=id,
|
||||
key=key,
|
||||
label=label,
|
||||
maximum=maximum,
|
||||
order=order,
|
||||
global_order=global_order,
|
||||
node_configuration_ids=node_configuration_ids,
|
||||
is_deleted=is_deleted,
|
||||
condition_id=condition_id,
|
||||
)
|
||||
|
||||
node_limit.additional_properties = d
|
||||
return node_limit
|
||||
|
||||
@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