79 lines
2.1 KiB
Python
79 lines
2.1 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 ..types import UNSET, Unset
|
|
|
|
T = TypeVar("T", bound="UpdateUserExternalModel")
|
|
|
|
|
|
@_attrs_define
|
|
class UpdateUserExternalModel:
|
|
"""Used for updating a user.
|
|
|
|
Attributes:
|
|
admin (bool): If the user is an administrator. Example: True.
|
|
name (str): The user name. For login. Example: unicorn.
|
|
pass_ (Union[Unset, str]): The user password. For login. Empty for using old password Example: nrocinu.
|
|
"""
|
|
|
|
admin: bool
|
|
name: str
|
|
pass_: Union[Unset, str] = UNSET
|
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> dict[str, Any]:
|
|
admin = self.admin
|
|
|
|
name = self.name
|
|
|
|
pass_ = self.pass_
|
|
|
|
field_dict: dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update(
|
|
{
|
|
"admin": admin,
|
|
"name": name,
|
|
}
|
|
)
|
|
if pass_ is not UNSET:
|
|
field_dict["pass"] = pass_
|
|
|
|
return field_dict
|
|
|
|
@classmethod
|
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
d = dict(src_dict)
|
|
admin = d.pop("admin")
|
|
|
|
name = d.pop("name")
|
|
|
|
pass_ = d.pop("pass", UNSET)
|
|
|
|
update_user_external_model = cls(
|
|
admin=admin,
|
|
name=name,
|
|
pass_=pass_,
|
|
)
|
|
|
|
update_user_external_model.additional_properties = d
|
|
return update_user_external_model
|
|
|
|
@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
|