From d70843f257131ef104c03713c2698a301a11a05f Mon Sep 17 00:00:00 2001 From: pantera Date: Mon, 5 Aug 2024 08:53:04 -0700 Subject: [PATCH] Fix sso profile resource (#314) * Default groups to None * Set defaults for all optional types and use Optional * Update mfa with default None * Add defaults to authentication payload --- workos/resources/mfa.py | 4 ++-- workos/resources/sso.py | 10 +++++----- workos/types/events/authentication_payload.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/workos/resources/mfa.py b/workos/resources/mfa.py index edf23c75..1c1f5462 100644 --- a/workos/resources/mfa.py +++ b/workos/resources/mfa.py @@ -45,14 +45,14 @@ class AuthenticationFactorTotp(AuthenticationFactorBase): """Representation of a MFA Authentication Factor Response as returned by WorkOS through the MFA feature.""" type: TotpAuthenticationFactorType - totp: Union[TotpFactor, ExtendedTotpFactor, None] + totp: Union[TotpFactor, ExtendedTotpFactor, None] = None class AuthenticationFactorSms(AuthenticationFactorBase): """Representation of a SMS Authentication Factor Response as returned by WorkOS through the MFA feature.""" type: SmsAuthenticationFactorType - sms: Union[SmsFactor, None] + sms: Union[SmsFactor, None] = None AuthenticationFactor = Union[AuthenticationFactorTotp, AuthenticationFactorSms] diff --git a/workos/resources/sso.py b/workos/resources/sso.py index eef4211e..17ea8c82 100644 --- a/workos/resources/sso.py +++ b/workos/resources/sso.py @@ -1,4 +1,4 @@ -from typing import Literal, Sequence, Union +from typing import Literal, Optional, Sequence, Union from workos.resources.workos_model import WorkOSModel from workos.types.sso.connection import Connection, ConnectionType from workos.typing.literals import LiteralOrUntyped @@ -11,12 +11,12 @@ class Profile(WorkOSModel): id: str connection_id: str connection_type: LiteralOrUntyped[ConnectionType] - organization_id: Union[str, None] + organization_id: Optional[str] = None email: str - first_name: Union[str, None] - last_name: Union[str, None] + first_name: Optional[str] = None + last_name: Optional[str] = None idp_id: str - groups: Union[Sequence[str], None] + groups: Optional[Sequence[str]] = None raw_attributes: dict diff --git a/workos/types/events/authentication_payload.py b/workos/types/events/authentication_payload.py index b7045e90..61c7a0be 100644 --- a/workos/types/events/authentication_payload.py +++ b/workos/types/events/authentication_payload.py @@ -1,10 +1,10 @@ -from typing import Literal, Union +from typing import Literal, Optional from workos.resources.workos_model import WorkOSModel class AuthenticationResultCommon(WorkOSModel): - ip_address: Union[str, None] - user_agent: Union[str, None] + ip_address: Optional[str] = None + user_agent: Optional[str] = None email: str created_at: str @@ -58,4 +58,4 @@ class AuthenticationPasswordSucceededPayload(AuthenticationResultSucceeded): class AuthenticationSsoSucceededPayload(AuthenticationResultSucceeded): type: Literal["sso"] - user_id: Union[str, None] + user_id: Optional[str] = None