Skip to content

Commit

Permalink
refactor: Set default value of tenant_id to None
Browse files Browse the repository at this point in the history
  • Loading branch information
KShivendu committed Aug 2, 2023
1 parent c002951 commit 661ac5a
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_email_verification_token(

def verify_email_using_token(
token: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.emailverification.asyncio import (
Expand Down
6 changes: 3 additions & 3 deletions supertokens_python/recipe/passwordless/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def get_user_by_email(

async def get_user_by_phone_number(
phone_number: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[User, None]:
if user_context is None:
Expand Down Expand Up @@ -246,7 +246,7 @@ async def list_codes_by_phone_number(

async def list_codes_by_device_id(
device_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[DeviceType, None]:
if user_context is None:
Expand All @@ -260,7 +260,7 @@ async def list_codes_by_device_id(

async def list_codes_by_pre_auth_session_id(
pre_auth_session_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[DeviceType, None]:
if user_context is None:
Expand Down
10 changes: 5 additions & 5 deletions supertokens_python/recipe/passwordless/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_user_by_email(

def get_user_by_phone_number(
phone_number: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[User, None]:
return sync(
Expand Down Expand Up @@ -195,7 +195,7 @@ def list_codes_by_phone_number(

def list_codes_by_device_id(
device_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[DeviceType, None]:
return sync(
Expand All @@ -207,7 +207,7 @@ def list_codes_by_device_id(

def list_codes_by_pre_auth_session_id(
pre_auth_session_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[DeviceType, None]:
return sync(
Expand All @@ -222,7 +222,7 @@ def list_codes_by_pre_auth_session_id(
def create_magic_link(
email: Union[str, None],
phone_number: Union[str, None],
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> str:
return sync(
Expand All @@ -238,7 +238,7 @@ def create_magic_link(
def signinup(
email: Union[str, None],
phone_number: Union[str, None],
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> ConsumeCodeOkResult:
return sync(
Expand Down
6 changes: 3 additions & 3 deletions supertokens_python/recipe/thirdparty/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def get_user_by_id(

async def get_users_by_email(
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[User]:
if user_context is None:
Expand All @@ -48,7 +48,7 @@ async def get_users_by_email(
async def get_user_by_third_party_info(
third_party_id: str,
third_party_user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -65,7 +65,7 @@ async def manually_create_or_update_user(
third_party_id: str,
third_party_user_id: str,
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand Down
8 changes: 5 additions & 3 deletions supertokens_python/recipe/thirdparty/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def get_user_by_id(


def get_users_by_email(
email: str, tenant_id: str, user_context: Union[None, Dict[str, Any]] = None
email: str,
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[User]:
from supertokens_python.recipe.thirdparty.asyncio import get_users_by_email

Expand All @@ -37,7 +39,7 @@ def get_users_by_email(
def get_user_by_third_party_info(
third_party_id: str,
third_party_user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdparty.asyncio import (
Expand All @@ -55,7 +57,7 @@ def manually_create_or_update_user(
third_party_id: str,
third_party_user_id: str,
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdparty.asyncio import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def get_user_by_id(
async def get_user_by_third_party_info(
third_party_id: str,
third_party_user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -52,7 +52,7 @@ async def thirdparty_manually_create_or_update_user(
third_party_id: str,
third_party_user_id: str,
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand Down Expand Up @@ -81,7 +81,7 @@ async def thirdparty_get_provider(

async def create_reset_password_token(
user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -94,7 +94,7 @@ async def create_reset_password_token(
async def reset_password_using_token(
token: str,
new_password: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -107,7 +107,7 @@ async def reset_password_using_token(
async def emailpassword_sign_in(
email: str,
password: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -120,7 +120,7 @@ async def emailpassword_sign_in(
async def emailpassword_sign_up(
email: str,
password: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -146,7 +146,7 @@ async def update_email_or_password(

async def get_users_by_email(
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[User]:
if user_context is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_user_by_id(
def get_user_by_third_party_info(
third_party_id: str,
third_party_user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand All @@ -52,7 +52,7 @@ def thirdparty_manually_create_or_update_user(
third_party_id: str,
third_party_user_id: str,
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand Down Expand Up @@ -83,7 +83,7 @@ def thirdparty_get_provider(

def create_reset_password_token(
user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand All @@ -96,7 +96,7 @@ def create_reset_password_token(
def reset_password_using_token(
token: str,
new_password: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand All @@ -111,7 +111,7 @@ def reset_password_using_token(
def emailpassword_sign_in(
email: str,
password: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[EmailPasswordSignInOkResult, EmailPasswordSignInWrongCredentialsError]:
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand All @@ -124,7 +124,7 @@ def emailpassword_sign_in(
def emailpassword_sign_up(
email: str,
password: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand Down Expand Up @@ -154,7 +154,7 @@ def update_email_or_password(

def get_users_by_email(
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[User]:
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def get_user_by_id(
async def get_user_by_third_party_info(
third_party_id: str,
third_party_user_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand All @@ -56,7 +56,7 @@ async def thirdparty_manually_create_or_update_user(
third_party_id: str,
third_party_user_id: str,
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
):
if user_context is None:
Expand Down Expand Up @@ -85,7 +85,7 @@ async def thirdparty_get_provider(

async def get_users_by_email(
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[User]:
if user_context is None:
Expand Down Expand Up @@ -160,7 +160,7 @@ async def consume_code(

async def get_user_by_phone_number(
phone_number: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[User, None]:
if user_context is None:
Expand Down Expand Up @@ -231,7 +231,7 @@ async def revoke_all_codes(

async def revoke_code(
code_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> interfaces.RevokeCodeOkResult:
if user_context is None:
Expand All @@ -245,7 +245,7 @@ async def revoke_code(

async def list_codes_by_email(
email: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[interfaces.DeviceType]:
if user_context is None:
Expand All @@ -257,7 +257,7 @@ async def list_codes_by_email(

async def list_codes_by_phone_number(
phone_number: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[interfaces.DeviceType]:
if user_context is None:
Expand All @@ -271,7 +271,7 @@ async def list_codes_by_phone_number(

async def list_codes_by_device_id(
device_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[interfaces.DeviceType, None]:
if user_context is None:
Expand All @@ -285,7 +285,7 @@ async def list_codes_by_device_id(

async def list_codes_by_pre_auth_session_id(
pre_auth_session_id: str,
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> Union[interfaces.DeviceType, None]:
if user_context is None:
Expand All @@ -300,7 +300,7 @@ async def list_codes_by_pre_auth_session_id(
async def create_magic_link(
email: Union[str, None],
phone_number: Union[str, None],
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> str:
if user_context is None:
Expand All @@ -316,7 +316,7 @@ async def create_magic_link(
async def passwordlessSigninup(
email: Union[str, None],
phone_number: Union[str, None],
tenant_id: Optional[str],
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> interfaces.ConsumeCodeOkResult:
if user_context is None:
Expand Down
Loading

0 comments on commit 661ac5a

Please sign in to comment.