cognee/cognee-mcp/cognee-api-client/cognee_api_client/models/user_update.py
2025-10-09 17:48:48 +01:00

151 lines
4.7 KiB
Python

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 ..types import UNSET, Unset
T = TypeVar("T", bound="UserUpdate")
@_attrs_define
class UserUpdate:
"""
Attributes:
password (Union[None, Unset, str]):
email (Union[None, Unset, str]):
is_active (Union[None, Unset, bool]):
is_superuser (Union[None, Unset, bool]):
is_verified (Union[None, Unset, bool]):
"""
password: Union[None, Unset, str] = UNSET
email: Union[None, Unset, str] = UNSET
is_active: Union[None, Unset, bool] = UNSET
is_superuser: Union[None, Unset, bool] = UNSET
is_verified: Union[None, Unset, bool] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
password: Union[None, Unset, str]
if isinstance(self.password, Unset):
password = UNSET
else:
password = self.password
email: Union[None, Unset, str]
if isinstance(self.email, Unset):
email = UNSET
else:
email = self.email
is_active: Union[None, Unset, bool]
if isinstance(self.is_active, Unset):
is_active = UNSET
else:
is_active = self.is_active
is_superuser: Union[None, Unset, bool]
if isinstance(self.is_superuser, Unset):
is_superuser = UNSET
else:
is_superuser = self.is_superuser
is_verified: Union[None, Unset, bool]
if isinstance(self.is_verified, Unset):
is_verified = UNSET
else:
is_verified = self.is_verified
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if password is not UNSET:
field_dict["password"] = password
if email is not UNSET:
field_dict["email"] = email
if is_active is not UNSET:
field_dict["is_active"] = is_active
if is_superuser is not UNSET:
field_dict["is_superuser"] = is_superuser
if is_verified is not UNSET:
field_dict["is_verified"] = is_verified
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
def _parse_password(data: object) -> Union[None, Unset, str]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, str], data)
password = _parse_password(d.pop("password", UNSET))
def _parse_email(data: object) -> Union[None, Unset, str]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, str], data)
email = _parse_email(d.pop("email", UNSET))
def _parse_is_active(data: object) -> Union[None, Unset, bool]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, bool], data)
is_active = _parse_is_active(d.pop("is_active", UNSET))
def _parse_is_superuser(data: object) -> Union[None, Unset, bool]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, bool], data)
is_superuser = _parse_is_superuser(d.pop("is_superuser", UNSET))
def _parse_is_verified(data: object) -> Union[None, Unset, bool]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, bool], data)
is_verified = _parse_is_verified(d.pop("is_verified", UNSET))
user_update = cls(
password=password,
email=email,
is_active=is_active,
is_superuser=is_superuser,
is_verified=is_verified,
)
user_update.additional_properties = d
return user_update
@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