diff --git a/gooyal_accounts_client/api/oauth2/__init__.py b/gooyal_accounts_client/api/oauth2/__init__.py index e69de29..2d7c0b2 100644 --- a/gooyal_accounts_client/api/oauth2/__init__.py +++ b/gooyal_accounts_client/api/oauth2/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/gooyal_accounts_client/api/users/__init__.py b/gooyal_accounts_client/api/users/__init__.py index e69de29..2d7c0b2 100644 --- a/gooyal_accounts_client/api/users/__init__.py +++ b/gooyal_accounts_client/api/users/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/gooyal_accounts_client/api/users/users_api_inquiry_create.py b/gooyal_accounts_client/api/users/users_api_inquiry_create.py new file mode 100644 index 0000000..971684f --- /dev/null +++ b/gooyal_accounts_client/api/users/users_api_inquiry_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.user_inquiry import UserInquiry +from ...types import Response + + +def _get_kwargs( + *, + body: UserInquiry, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/users/api/inquiry/", + } + + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UserInquiry]: + if response.status_code == 201: + response_201 = UserInquiry.from_dict(response.json()) + + return response_201 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UserInquiry]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: UserInquiry, +) -> Response[UserInquiry]: + """ + Args: + body (UserInquiry): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[UserInquiry] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: UserInquiry, +) -> Optional[UserInquiry]: + """ + Args: + body (UserInquiry): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + UserInquiry + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: UserInquiry, +) -> Response[UserInquiry]: + """ + Args: + body (UserInquiry): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[UserInquiry] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: UserInquiry, +) -> Optional[UserInquiry]: + """ + Args: + body (UserInquiry): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + UserInquiry + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/gooyal_accounts_client/api/users/users_api_users_details_retrieve.py b/gooyal_accounts_client/api/users/users_api_users_details_retrieve.py new file mode 100644 index 0000000..1da2a43 --- /dev/null +++ b/gooyal_accounts_client/api/users/users_api_users_details_retrieve.py @@ -0,0 +1,143 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.account import Account +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/users/api/users/{uuid}/details", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Account]: + if response.status_code == 200: + response_200 = Account.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Account]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Account]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Account] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[Account]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Account + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Account]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Account] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[Account]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Account + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/gooyal_accounts_client/models/__init__.py b/gooyal_accounts_client/models/__init__.py index 185bd96..91f431d 100644 --- a/gooyal_accounts_client/models/__init__.py +++ b/gooyal_accounts_client/models/__init__.py @@ -2,7 +2,10 @@ from .account import Account from .application import Application +from .blank_enum import BlankEnum from .change_password import ChangePassword +from .education_degree_enum import EducationDegreeEnum +from .gender_enum import GenderEnum from .paginated_application_list import PaginatedApplicationList from .paginated_public_user_list import PaginatedPublicUserList from .patched_account import PatchedAccount @@ -10,11 +13,15 @@ from .patched_change_password import PatchedChangePassword from .public_user import PublicUser from .request_otp import RequestOTP from .request_ott import RequestOTT +from .user_inquiry import UserInquiry __all__ = ( "Account", "Application", + "BlankEnum", "ChangePassword", + "EducationDegreeEnum", + "GenderEnum", "PaginatedApplicationList", "PaginatedPublicUserList", "PatchedAccount", @@ -22,4 +29,5 @@ __all__ = ( "PublicUser", "RequestOTP", "RequestOTT", + "UserInquiry", ) diff --git a/gooyal_accounts_client/models/account.py b/gooyal_accounts_client/models/account.py index 589a7a8..b53855c 100644 --- a/gooyal_accounts_client/models/account.py +++ b/gooyal_accounts_client/models/account.py @@ -1,9 +1,15 @@ +import datetime +from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field +from dateutil.parser import isoparse +from ..models.blank_enum import BlankEnum +from ..models.education_degree_enum import EducationDegreeEnum +from ..models.gender_enum import GenderEnum from ..types import UNSET, Unset T = TypeVar("T", bound="Account") @@ -24,6 +30,10 @@ class Account: last_name (Union[Unset, str]): name (Union[Unset, str]): avatar (Union[None, Unset, str]): + gender (Union[BlankEnum, GenderEnum, None, Unset]): + education_degree (Union[BlankEnum, EducationDegreeEnum, None, Unset]): + education_field (Union[None, Unset, str]): + birthdate (Union[None, Unset, datetime.date]): iban (Union[None, Unset, str]): province (Union[None, Unset, int]): city (Union[None, Unset, int]): @@ -42,6 +52,10 @@ class Account: last_name: Union[Unset, str] = UNSET name: Union[Unset, str] = UNSET avatar: Union[None, Unset, str] = UNSET + gender: Union[BlankEnum, GenderEnum, None, Unset] = UNSET + education_degree: Union[BlankEnum, EducationDegreeEnum, None, Unset] = UNSET + education_field: Union[None, Unset, str] = UNSET + birthdate: Union[None, Unset, datetime.date] = UNSET iban: Union[None, Unset, str] = UNSET province: Union[None, Unset, int] = UNSET city: Union[None, Unset, int] = UNSET @@ -81,6 +95,40 @@ class Account: else: avatar = self.avatar + gender: Union[None, Unset, str] + if isinstance(self.gender, Unset): + gender = UNSET + elif isinstance(self.gender, GenderEnum): + gender = self.gender.value + elif isinstance(self.gender, BlankEnum): + gender = self.gender.value + else: + gender = self.gender + + education_degree: Union[None, Unset, str] + if isinstance(self.education_degree, Unset): + education_degree = UNSET + elif isinstance(self.education_degree, EducationDegreeEnum): + education_degree = self.education_degree.value + elif isinstance(self.education_degree, BlankEnum): + education_degree = self.education_degree.value + else: + education_degree = self.education_degree + + education_field: Union[None, Unset, str] + if isinstance(self.education_field, Unset): + education_field = UNSET + else: + education_field = self.education_field + + birthdate: Union[None, Unset, str] + if isinstance(self.birthdate, Unset): + birthdate = UNSET + elif isinstance(self.birthdate, datetime.date): + birthdate = self.birthdate.isoformat() + else: + birthdate = self.birthdate + iban: Union[None, Unset, str] if isinstance(self.iban, Unset): iban = UNSET @@ -133,6 +181,14 @@ class Account: field_dict["name"] = name if avatar is not UNSET: field_dict["avatar"] = avatar + if gender is not UNSET: + field_dict["gender"] = gender + if education_degree is not UNSET: + field_dict["education_degree"] = education_degree + if education_field is not UNSET: + field_dict["education_field"] = education_field + if birthdate is not UNSET: + field_dict["birthdate"] = birthdate if iban is not UNSET: field_dict["iban"] = iban if province is not UNSET: @@ -147,8 +203,8 @@ class Account: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) uuid = UUID(d.pop("uuid")) email = d.pop("email") @@ -190,6 +246,82 @@ class Account: avatar = _parse_avatar(d.pop("avatar", UNSET)) + def _parse_gender(data: object) -> Union[BlankEnum, GenderEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + gender_type_0 = GenderEnum(data) + + return gender_type_0 + except: # noqa: E722 + pass + try: + if not isinstance(data, str): + raise TypeError() + gender_type_1 = BlankEnum(data) + + return gender_type_1 + except: # noqa: E722 + pass + return cast(Union[BlankEnum, GenderEnum, None, Unset], data) + + gender = _parse_gender(d.pop("gender", UNSET)) + + def _parse_education_degree(data: object) -> Union[BlankEnum, EducationDegreeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + education_degree_type_0 = EducationDegreeEnum(data) + + return education_degree_type_0 + except: # noqa: E722 + pass + try: + if not isinstance(data, str): + raise TypeError() + education_degree_type_1 = BlankEnum(data) + + return education_degree_type_1 + except: # noqa: E722 + pass + return cast(Union[BlankEnum, EducationDegreeEnum, None, Unset], data) + + education_degree = _parse_education_degree(d.pop("education_degree", UNSET)) + + def _parse_education_field(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) + + education_field = _parse_education_field(d.pop("education_field", UNSET)) + + def _parse_birthdate(data: object) -> Union[None, Unset, datetime.date]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + birthdate_type_0 = isoparse(data).date() + + return birthdate_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, datetime.date], data) + + birthdate = _parse_birthdate(d.pop("birthdate", UNSET)) + def _parse_iban(data: object) -> Union[None, Unset, str]: if data is None: return data @@ -247,6 +379,10 @@ class Account: last_name=last_name, name=name, avatar=avatar, + gender=gender, + education_degree=education_degree, + education_field=education_field, + birthdate=birthdate, iban=iban, province=province, city=city, diff --git a/gooyal_accounts_client/models/application.py b/gooyal_accounts_client/models/application.py index bae2ccc..c3538c5 100644 --- a/gooyal_accounts_client/models/application.py +++ b/gooyal_accounts_client/models/application.py @@ -1,4 +1,5 @@ -from typing import Any, TypeVar +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast from uuid import UUID from attrs import define as _attrs_define @@ -13,6 +14,7 @@ class Application: Attributes: uuid (UUID): name (str): + avatar (Union[None, str]): client_id (str): user (UUID): allowed_scope (str): @@ -20,6 +22,7 @@ class Application: uuid: UUID name: str + avatar: Union[None, str] client_id: str user: UUID allowed_scope: str @@ -30,6 +33,9 @@ class Application: name = self.name + avatar: Union[None, str] + avatar = self.avatar + client_id = self.client_id user = str(self.user) @@ -42,6 +48,7 @@ class Application: { "uuid": uuid, "name": name, + "avatar": avatar, "client_id": client_id, "user": user, "allowed_scope": allowed_scope, @@ -51,12 +58,19 @@ class Application: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) uuid = UUID(d.pop("uuid")) name = d.pop("name") + def _parse_avatar(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + avatar = _parse_avatar(d.pop("avatar")) + client_id = d.pop("client_id") user = UUID(d.pop("user")) @@ -66,6 +80,7 @@ class Application: application = cls( uuid=uuid, name=name, + avatar=avatar, client_id=client_id, user=user, allowed_scope=allowed_scope, diff --git a/gooyal_accounts_client/models/blank_enum.py b/gooyal_accounts_client/models/blank_enum.py new file mode 100644 index 0000000..8a87569 --- /dev/null +++ b/gooyal_accounts_client/models/blank_enum.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class BlankEnum(str, Enum): + VALUE_0 = "" + + def __str__(self) -> str: + return str(self.value) diff --git a/gooyal_accounts_client/models/change_password.py b/gooyal_accounts_client/models/change_password.py index 7065c9d..a49b227 100644 --- a/gooyal_accounts_client/models/change_password.py +++ b/gooyal_accounts_client/models/change_password.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from typing import Any, TypeVar, Union from attrs import define as _attrs_define @@ -43,8 +44,8 @@ class ChangePassword: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) old_password = d.pop("old_password") new_password = d.pop("new_password") diff --git a/gooyal_accounts_client/models/education_degree_enum.py b/gooyal_accounts_client/models/education_degree_enum.py new file mode 100644 index 0000000..d8d5573 --- /dev/null +++ b/gooyal_accounts_client/models/education_degree_enum.py @@ -0,0 +1,14 @@ +from enum import Enum + + +class EducationDegreeEnum(str, Enum): + ASSOCIATE = "associate" + BACHELORS = "bachelors" + DOCTORATE = "doctorate" + HIGH = "high" + MASTERS = "masters" + MIDDLE = "middle" + PRIMARY = "primary" + + def __str__(self) -> str: + return str(self.value) diff --git a/gooyal_accounts_client/models/gender_enum.py b/gooyal_accounts_client/models/gender_enum.py new file mode 100644 index 0000000..2da7760 --- /dev/null +++ b/gooyal_accounts_client/models/gender_enum.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class GenderEnum(str, Enum): + F = "f" + M = "m" + + def __str__(self) -> str: + return str(self.value) diff --git a/gooyal_accounts_client/models/paginated_application_list.py b/gooyal_accounts_client/models/paginated_application_list.py index c0b4d8b..3d76808 100644 --- a/gooyal_accounts_client/models/paginated_application_list.py +++ b/gooyal_accounts_client/models/paginated_application_list.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define @@ -64,10 +65,10 @@ class PaginatedApplicationList: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.application import Application - d = src_dict.copy() + d = dict(src_dict) count = d.pop("count") results = [] diff --git a/gooyal_accounts_client/models/paginated_public_user_list.py b/gooyal_accounts_client/models/paginated_public_user_list.py index e7096e5..dbea027 100644 --- a/gooyal_accounts_client/models/paginated_public_user_list.py +++ b/gooyal_accounts_client/models/paginated_public_user_list.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define @@ -64,10 +65,10 @@ class PaginatedPublicUserList: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.public_user import PublicUser - d = src_dict.copy() + d = dict(src_dict) count = d.pop("count") results = [] diff --git a/gooyal_accounts_client/models/patched_account.py b/gooyal_accounts_client/models/patched_account.py index b01553d..837b3be 100644 --- a/gooyal_accounts_client/models/patched_account.py +++ b/gooyal_accounts_client/models/patched_account.py @@ -1,9 +1,15 @@ +import datetime +from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field +from dateutil.parser import isoparse +from ..models.blank_enum import BlankEnum +from ..models.education_degree_enum import EducationDegreeEnum +from ..models.gender_enum import GenderEnum from ..types import UNSET, Unset T = TypeVar("T", bound="PatchedAccount") @@ -21,6 +27,10 @@ class PatchedAccount: last_name (Union[Unset, str]): name (Union[Unset, str]): avatar (Union[None, Unset, str]): + gender (Union[BlankEnum, GenderEnum, None, Unset]): + education_degree (Union[BlankEnum, EducationDegreeEnum, None, Unset]): + education_field (Union[None, Unset, str]): + birthdate (Union[None, Unset, datetime.date]): iban (Union[None, Unset, str]): iban_verified (Union[None, Unset, bool]): province (Union[None, Unset, int]): @@ -39,6 +49,10 @@ class PatchedAccount: last_name: Union[Unset, str] = UNSET name: Union[Unset, str] = UNSET avatar: Union[None, Unset, str] = UNSET + gender: Union[BlankEnum, GenderEnum, None, Unset] = UNSET + education_degree: Union[BlankEnum, EducationDegreeEnum, None, Unset] = UNSET + education_field: Union[None, Unset, str] = UNSET + birthdate: Union[None, Unset, datetime.date] = UNSET iban: Union[None, Unset, str] = UNSET iban_verified: Union[None, Unset, bool] = UNSET province: Union[None, Unset, int] = UNSET @@ -76,6 +90,40 @@ class PatchedAccount: else: avatar = self.avatar + gender: Union[None, Unset, str] + if isinstance(self.gender, Unset): + gender = UNSET + elif isinstance(self.gender, GenderEnum): + gender = self.gender.value + elif isinstance(self.gender, BlankEnum): + gender = self.gender.value + else: + gender = self.gender + + education_degree: Union[None, Unset, str] + if isinstance(self.education_degree, Unset): + education_degree = UNSET + elif isinstance(self.education_degree, EducationDegreeEnum): + education_degree = self.education_degree.value + elif isinstance(self.education_degree, BlankEnum): + education_degree = self.education_degree.value + else: + education_degree = self.education_degree + + education_field: Union[None, Unset, str] + if isinstance(self.education_field, Unset): + education_field = UNSET + else: + education_field = self.education_field + + birthdate: Union[None, Unset, str] + if isinstance(self.birthdate, Unset): + birthdate = UNSET + elif isinstance(self.birthdate, datetime.date): + birthdate = self.birthdate.isoformat() + else: + birthdate = self.birthdate + iban: Union[None, Unset, str] if isinstance(self.iban, Unset): iban = UNSET @@ -135,6 +183,14 @@ class PatchedAccount: field_dict["name"] = name if avatar is not UNSET: field_dict["avatar"] = avatar + if gender is not UNSET: + field_dict["gender"] = gender + if education_degree is not UNSET: + field_dict["education_degree"] = education_degree + if education_field is not UNSET: + field_dict["education_field"] = education_field + if birthdate is not UNSET: + field_dict["birthdate"] = birthdate if iban is not UNSET: field_dict["iban"] = iban if iban_verified is not UNSET: @@ -155,8 +211,8 @@ class PatchedAccount: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) _uuid = d.pop("uuid", UNSET) uuid: Union[Unset, UUID] if isinstance(_uuid, Unset): @@ -192,6 +248,82 @@ class PatchedAccount: avatar = _parse_avatar(d.pop("avatar", UNSET)) + def _parse_gender(data: object) -> Union[BlankEnum, GenderEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + gender_type_0 = GenderEnum(data) + + return gender_type_0 + except: # noqa: E722 + pass + try: + if not isinstance(data, str): + raise TypeError() + gender_type_1 = BlankEnum(data) + + return gender_type_1 + except: # noqa: E722 + pass + return cast(Union[BlankEnum, GenderEnum, None, Unset], data) + + gender = _parse_gender(d.pop("gender", UNSET)) + + def _parse_education_degree(data: object) -> Union[BlankEnum, EducationDegreeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + education_degree_type_0 = EducationDegreeEnum(data) + + return education_degree_type_0 + except: # noqa: E722 + pass + try: + if not isinstance(data, str): + raise TypeError() + education_degree_type_1 = BlankEnum(data) + + return education_degree_type_1 + except: # noqa: E722 + pass + return cast(Union[BlankEnum, EducationDegreeEnum, None, Unset], data) + + education_degree = _parse_education_degree(d.pop("education_degree", UNSET)) + + def _parse_education_field(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) + + education_field = _parse_education_field(d.pop("education_field", UNSET)) + + def _parse_birthdate(data: object) -> Union[None, Unset, datetime.date]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + birthdate_type_0 = isoparse(data).date() + + return birthdate_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, datetime.date], data) + + birthdate = _parse_birthdate(d.pop("birthdate", UNSET)) + def _parse_iban(data: object) -> Union[None, Unset, str]: if data is None: return data @@ -259,6 +391,10 @@ class PatchedAccount: last_name=last_name, name=name, avatar=avatar, + gender=gender, + education_degree=education_degree, + education_field=education_field, + birthdate=birthdate, iban=iban, iban_verified=iban_verified, province=province, diff --git a/gooyal_accounts_client/models/patched_change_password.py b/gooyal_accounts_client/models/patched_change_password.py index 5651f7e..60bb80a 100644 --- a/gooyal_accounts_client/models/patched_change_password.py +++ b/gooyal_accounts_client/models/patched_change_password.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from typing import Any, TypeVar, Union from attrs import define as _attrs_define @@ -42,8 +43,8 @@ class PatchedChangePassword: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) old_password = d.pop("old_password", UNSET) old_password_field = d.pop("old_password_field", UNSET) diff --git a/gooyal_accounts_client/models/public_user.py b/gooyal_accounts_client/models/public_user.py index 7968433..7d834e8 100644 --- a/gooyal_accounts_client/models/public_user.py +++ b/gooyal_accounts_client/models/public_user.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from uuid import UUID @@ -58,8 +59,8 @@ class PublicUser: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) def _parse_avatar(data: object) -> Union[None, str]: if data is None: diff --git a/gooyal_accounts_client/models/request_otp.py b/gooyal_accounts_client/models/request_otp.py index e67b1e5..a72c886 100644 --- a/gooyal_accounts_client/models/request_otp.py +++ b/gooyal_accounts_client/models/request_otp.py @@ -1,4 +1,5 @@ import datetime +from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define @@ -46,8 +47,8 @@ class RequestOTP: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) phone_number = d.pop("phone_number") def _parse_otp_expire(data: object) -> Union[None, datetime.datetime]: diff --git a/gooyal_accounts_client/models/request_ott.py b/gooyal_accounts_client/models/request_ott.py index 75c5b6f..a48091b 100644 --- a/gooyal_accounts_client/models/request_ott.py +++ b/gooyal_accounts_client/models/request_ott.py @@ -1,4 +1,5 @@ import datetime +from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define @@ -47,8 +48,8 @@ class RequestOTT: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) application = d.pop("application") def _parse_ott(data: object) -> Union[None, str]: diff --git a/gooyal_accounts_client/models/user_inquiry.py b/gooyal_accounts_client/models/user_inquiry.py new file mode 100644 index 0000000..d507185 --- /dev/null +++ b/gooyal_accounts_client/models/user_inquiry.py @@ -0,0 +1,68 @@ +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UserInquiry") + + +@_attrs_define +class UserInquiry: + """ + Attributes: + uuid (UUID): + phone_number (str): + """ + + uuid: UUID + phone_number: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + phone_number = self.phone_number + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "phone_number": phone_number, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + phone_number = d.pop("phone_number") + + user_inquiry = cls( + uuid=uuid, + phone_number=phone_number, + ) + + user_inquiry.additional_properties = d + return user_inquiry + + @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