87 lines
2.5 KiB
Python
87 lines
2.5 KiB
Python
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 .. import types
|
|
from ..types import UNSET, Unset
|
|
|
|
T = TypeVar("T", bound="CreateAnonymousLogin")
|
|
|
|
|
|
@_attrs_define
|
|
class CreateAnonymousLogin:
|
|
"""Serializer used for AnonymousLogin creation.
|
|
Adds `testing` (default to False) in data if not given.
|
|
|
|
Attributes:
|
|
active_module_id (int):
|
|
testing (Union[Unset, bool]): Default: False.
|
|
"""
|
|
|
|
active_module_id: int
|
|
testing: Union[Unset, bool] = False
|
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> dict[str, Any]:
|
|
active_module_id = self.active_module_id
|
|
|
|
testing = self.testing
|
|
|
|
field_dict: dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update(
|
|
{
|
|
"active_module_id": active_module_id,
|
|
}
|
|
)
|
|
if testing is not UNSET:
|
|
field_dict["testing"] = testing
|
|
|
|
return field_dict
|
|
|
|
def to_multipart(self) -> types.RequestFiles:
|
|
files: types.RequestFiles = []
|
|
|
|
files.append(("active_module_id", (None, str(self.active_module_id).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.testing, Unset):
|
|
files.append(("testing", (None, str(self.testing).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)
|
|
active_module_id = d.pop("active_module_id")
|
|
|
|
testing = d.pop("testing", UNSET)
|
|
|
|
create_anonymous_login = cls(
|
|
active_module_id=active_module_id,
|
|
testing=testing,
|
|
)
|
|
|
|
create_anonymous_login.additional_properties = d
|
|
return create_anonymous_login
|
|
|
|
@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
|