Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions robosystems_client/models/auth_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ class AuthResponse:
user (AuthResponseUser): User information
message (str): Success message
token (Union[None, Unset, str]): JWT authentication token (optional for cookie-based auth)
expires_in (Union[None, Unset, int]): Token expiry time in seconds from now
refresh_threshold (Union[None, Unset, int]): Recommended refresh threshold in seconds before expiry
"""

user: "AuthResponseUser"
message: str
token: Union[None, Unset, str] = UNSET
expires_in: Union[None, Unset, int] = UNSET
refresh_threshold: Union[None, Unset, int] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> dict[str, Any]:
Expand All @@ -39,6 +43,18 @@ def to_dict(self) -> dict[str, Any]:
else:
token = self.token

expires_in: Union[None, Unset, int]
if isinstance(self.expires_in, Unset):
expires_in = UNSET
else:
expires_in = self.expires_in

refresh_threshold: Union[None, Unset, int]
if isinstance(self.refresh_threshold, Unset):
refresh_threshold = UNSET
else:
refresh_threshold = self.refresh_threshold

field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
Expand All @@ -49,6 +65,10 @@ def to_dict(self) -> dict[str, Any]:
)
if token is not UNSET:
field_dict["token"] = token
if expires_in is not UNSET:
field_dict["expires_in"] = expires_in
if refresh_threshold is not UNSET:
field_dict["refresh_threshold"] = refresh_threshold

return field_dict

Expand All @@ -70,10 +90,30 @@ def _parse_token(data: object) -> Union[None, Unset, str]:

token = _parse_token(d.pop("token", UNSET))

def _parse_expires_in(data: object) -> Union[None, Unset, int]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, int], data)

expires_in = _parse_expires_in(d.pop("expires_in", UNSET))

def _parse_refresh_threshold(data: object) -> Union[None, Unset, int]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, int], data)

refresh_threshold = _parse_refresh_threshold(d.pop("refresh_threshold", UNSET))

auth_response = cls(
user=user,
message=message,
token=token,
expires_in=expires_in,
refresh_threshold=refresh_threshold,
)

auth_response.additional_properties = d
Expand Down