Module supertokens_python.recipe.emailpassword.interfaces

Expand source code
# Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
#
# This software is licensed under the Apache License, Version 2.0 (the
# "License") as published by the Apache Software Foundation.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Dict, List, Union

from supertokens_python.ingredients.emaildelivery import \
    EmailDeliveryIngredient
from supertokens_python.recipe.emailpassword.types import \
    TypeEmailPasswordEmailDeliveryInput

from ...types import APIResponse
from ..emailverification.interfaces import \
    RecipeInterface as EmailVerificationRecipeInterface

if TYPE_CHECKING:
    from supertokens_python.framework import BaseRequest, BaseResponse
    from supertokens_python.recipe.session import SessionContainer

    from .types import FormField, User
    from .utils import EmailPasswordConfig


class SignUpOkResult():
    def __init__(self, user: User):
        self.user = user


class SignUpEmailAlreadyExistsError():
    pass


class SignInOkResult():
    def __init__(self, user: User):
        self.user = user


class SignInWrongCredentialsError():
    pass


class CreateResetPasswordOkResult():
    def __init__(self, token: str):
        self.token = token


class CreateResetPasswordWrongUserIdError():
    pass


class ResetPasswordUsingTokenOkResult():
    def __init__(self, user_id: Union[str, None]):
        self.user_id = user_id


class ResetPasswordUsingTokenInvalidTokenError():
    pass


class UpdateEmailOrPasswordOkResult():
    pass


class UpdateEmailOrPasswordEmailAlreadyExistsError():
    pass


class UpdateEmailOrPasswordUnknownUserIdError():
    pass


class RecipeInterface(ABC):
    def __init__(self):
        pass

    @abstractmethod
    async def get_user_by_id(self, user_id: str, user_context: Dict[str, Any]) -> Union[User, None]:
        pass

    @abstractmethod
    async def get_user_by_email(self, email: str, user_context: Dict[str, Any]) -> Union[User, None]:
        pass

    @abstractmethod
    async def create_reset_password_token(self, user_id: str, user_context: Dict[str, Any]) -> Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]:
        pass

    @abstractmethod
    async def reset_password_using_token(self, token: str, new_password: str,
                                         user_context: Dict[str, Any]) -> Union[ResetPasswordUsingTokenOkResult, ResetPasswordUsingTokenInvalidTokenError]:
        pass

    @abstractmethod
    async def sign_in(self, email: str, password: str, user_context: Dict[str, Any]) -> Union[SignInOkResult, SignInWrongCredentialsError]:
        pass

    @abstractmethod
    async def sign_up(self, email: str, password: str, user_context: Dict[str, Any]) -> Union[SignUpOkResult, SignUpEmailAlreadyExistsError]:
        pass

    @abstractmethod
    async def update_email_or_password(self, user_id: str, email: Union[str, None],
                                       password: Union[str, None], user_context: Dict[str, Any]) -> Union[UpdateEmailOrPasswordOkResult, UpdateEmailOrPasswordEmailAlreadyExistsError, UpdateEmailOrPasswordUnknownUserIdError]:
        pass


class APIOptions:
    def __init__(self, request: BaseRequest, response: BaseResponse, recipe_id: str,
                 config: EmailPasswordConfig, recipe_implementation: RecipeInterface,
                 email_verification_recipe_implementation: EmailVerificationRecipeInterface,
                 email_delivery: EmailDeliveryIngredient[TypeEmailPasswordEmailDeliveryInput]):
        self.request: BaseRequest = request
        self.response: BaseResponse = response
        self.recipe_id: str = recipe_id
        self.config: EmailPasswordConfig = config
        self.recipe_implementation: RecipeInterface = recipe_implementation
        self.email_verification_recipe_implementation: EmailVerificationRecipeInterface = email_verification_recipe_implementation
        self.email_delivery = email_delivery


class EmailVerifyPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user: User):
        self.user = user

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'user': {
                'id': self.user.user_id,
                'email': self.user.email
            }
        }


class EmailVerifyPostInvalidTokenError(APIResponse):
    status: str = 'EMAIL_VERIFICATION_INVALID_TOKEN_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class IsEmailVerifiedGetOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, is_verified: bool):
        self.is_verified = is_verified

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'isVerified': self.is_verified
        }


class GenerateEmailVerifyTokenPostOkResult(APIResponse):
    status: str = 'OK'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class GenerateEmailVerifyTokenPostEmailAlreadyVerifiedError(APIResponse):
    status: str = 'EMAIL_ALREADY_VERIFIED_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class EmailExistsGetOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, exists: bool):
        self.exists = exists

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'exists': self.exists
        }


class GeneratePasswordResetTokenPostOkResult(APIResponse):
    status: str = 'OK'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class PasswordResetPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user_id: Union[str, None]):
        self.user_id = user_id

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class PasswordResetPostInvalidTokenResponse(APIResponse):
    status: str = 'RESET_PASSWORD_INVALID_TOKEN_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class SignInPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user: User, session: SessionContainer):
        self.user = user
        self.session = session

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'user': {
                'id': self.user.user_id,
                'email': self.user.email,
                'timeJoined': self.user.time_joined
            },
        }


class SignInPostWrongCredentialsError(APIResponse):
    status: str = 'WRONG_CREDENTIALS_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class SignUpPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user: User, session: SessionContainer):
        self.user = user
        self.session = session

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'user': {
                'id': self.user.user_id,
                'email': self.user.email,
                'timeJoined': self.user.time_joined
            },
        }


class SignUpPostEmailAlreadyExistsError(APIResponse):
    status: str = 'EMAIL_ALREADY_EXISTS_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }


class APIInterface:
    def __init__(self):
        self.disable_email_exists_get = False
        self.disable_generate_password_reset_token_post = False
        self.disable_password_reset_post = False
        self.disable_sign_in_post = False
        self.disable_sign_up_post = False

    @abstractmethod
    async def email_exists_get(self, email: str, api_options: APIOptions, user_context: Dict[str, Any]) -> EmailExistsGetOkResult:
        pass

    @abstractmethod
    async def generate_password_reset_token_post(self, form_fields: List[FormField],
                                                 api_options: APIOptions,
                                                 user_context: Dict[str, Any]) -> GeneratePasswordResetTokenPostOkResult:
        pass

    @abstractmethod
    async def password_reset_post(self, form_fields: List[FormField], token: str,
                                  api_options: APIOptions, user_context: Dict[str, Any]) -> Union[PasswordResetPostOkResult, PasswordResetPostInvalidTokenResponse]:
        pass

    @abstractmethod
    async def sign_in_post(self, form_fields: List[FormField],
                           api_options: APIOptions,
                           user_context: Dict[str, Any]) -> Union[SignInPostOkResult, SignInPostWrongCredentialsError]:
        pass

    @abstractmethod
    async def sign_up_post(self, form_fields: List[FormField],
                           api_options: APIOptions,
                           user_context: Dict[str, Any]) -> Union[SignUpPostOkResult, SignUpPostEmailAlreadyExistsError]:
        pass

Classes

class APIInterface
Expand source code
class APIInterface:
    def __init__(self):
        self.disable_email_exists_get = False
        self.disable_generate_password_reset_token_post = False
        self.disable_password_reset_post = False
        self.disable_sign_in_post = False
        self.disable_sign_up_post = False

    @abstractmethod
    async def email_exists_get(self, email: str, api_options: APIOptions, user_context: Dict[str, Any]) -> EmailExistsGetOkResult:
        pass

    @abstractmethod
    async def generate_password_reset_token_post(self, form_fields: List[FormField],
                                                 api_options: APIOptions,
                                                 user_context: Dict[str, Any]) -> GeneratePasswordResetTokenPostOkResult:
        pass

    @abstractmethod
    async def password_reset_post(self, form_fields: List[FormField], token: str,
                                  api_options: APIOptions, user_context: Dict[str, Any]) -> Union[PasswordResetPostOkResult, PasswordResetPostInvalidTokenResponse]:
        pass

    @abstractmethod
    async def sign_in_post(self, form_fields: List[FormField],
                           api_options: APIOptions,
                           user_context: Dict[str, Any]) -> Union[SignInPostOkResult, SignInPostWrongCredentialsError]:
        pass

    @abstractmethod
    async def sign_up_post(self, form_fields: List[FormField],
                           api_options: APIOptions,
                           user_context: Dict[str, Any]) -> Union[SignUpPostOkResult, SignUpPostEmailAlreadyExistsError]:
        pass

Subclasses

Methods

async def email_exists_get(self, email: str, api_options: APIOptions, user_context: Dict[str, Any]) ‑> EmailExistsGetOkResult
Expand source code
@abstractmethod
async def email_exists_get(self, email: str, api_options: APIOptions, user_context: Dict[str, Any]) -> EmailExistsGetOkResult:
    pass
async def generate_password_reset_token_post(self, form_fields: List[FormField], api_options: APIOptions, user_context: Dict[str, Any]) ‑> GeneratePasswordResetTokenPostOkResult
Expand source code
@abstractmethod
async def generate_password_reset_token_post(self, form_fields: List[FormField],
                                             api_options: APIOptions,
                                             user_context: Dict[str, Any]) -> GeneratePasswordResetTokenPostOkResult:
    pass
async def password_reset_post(self, form_fields: List[FormField], token: str, api_options: APIOptions, user_context: Dict[str, Any]) ‑> Union[PasswordResetPostOkResultPasswordResetPostInvalidTokenResponse]
Expand source code
@abstractmethod
async def password_reset_post(self, form_fields: List[FormField], token: str,
                              api_options: APIOptions, user_context: Dict[str, Any]) -> Union[PasswordResetPostOkResult, PasswordResetPostInvalidTokenResponse]:
    pass
async def sign_in_post(self, form_fields: List[FormField], api_options: APIOptions, user_context: Dict[str, Any]) ‑> Union[SignInPostOkResultSignInPostWrongCredentialsError]
Expand source code
@abstractmethod
async def sign_in_post(self, form_fields: List[FormField],
                       api_options: APIOptions,
                       user_context: Dict[str, Any]) -> Union[SignInPostOkResult, SignInPostWrongCredentialsError]:
    pass
async def sign_up_post(self, form_fields: List[FormField], api_options: APIOptions, user_context: Dict[str, Any]) ‑> Union[SignUpPostOkResultSignUpPostEmailAlreadyExistsError]
Expand source code
@abstractmethod
async def sign_up_post(self, form_fields: List[FormField],
                       api_options: APIOptions,
                       user_context: Dict[str, Any]) -> Union[SignUpPostOkResult, SignUpPostEmailAlreadyExistsError]:
    pass
class APIOptions (request: BaseRequest, response: BaseResponse, recipe_id: str, config: EmailPasswordConfig, recipe_implementation: RecipeInterface, email_verification_recipe_implementation: EmailVerificationRecipeInterface, email_delivery: EmailDeliveryIngredient[TypeEmailPasswordEmailDeliveryInput])
Expand source code
class APIOptions:
    def __init__(self, request: BaseRequest, response: BaseResponse, recipe_id: str,
                 config: EmailPasswordConfig, recipe_implementation: RecipeInterface,
                 email_verification_recipe_implementation: EmailVerificationRecipeInterface,
                 email_delivery: EmailDeliveryIngredient[TypeEmailPasswordEmailDeliveryInput]):
        self.request: BaseRequest = request
        self.response: BaseResponse = response
        self.recipe_id: str = recipe_id
        self.config: EmailPasswordConfig = config
        self.recipe_implementation: RecipeInterface = recipe_implementation
        self.email_verification_recipe_implementation: EmailVerificationRecipeInterface = email_verification_recipe_implementation
        self.email_delivery = email_delivery
class CreateResetPasswordOkResult (token: str)
Expand source code
class CreateResetPasswordOkResult():
    def __init__(self, token: str):
        self.token = token
class CreateResetPasswordWrongUserIdError
Expand source code
class CreateResetPasswordWrongUserIdError():
    pass
class EmailExistsGetOkResult (exists: bool)

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class EmailExistsGetOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, exists: bool):
        self.exists = exists

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'exists': self.exists
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status,
        'exists': self.exists
    }
class EmailVerifyPostInvalidTokenError

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class EmailVerifyPostInvalidTokenError(APIResponse):
    status: str = 'EMAIL_VERIFICATION_INVALID_TOKEN_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class EmailVerifyPostOkResult (user: User)

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class EmailVerifyPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user: User):
        self.user = user

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'user': {
                'id': self.user.user_id,
                'email': self.user.email
            }
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status,
        'user': {
            'id': self.user.user_id,
            'email': self.user.email
        }
    }
class GenerateEmailVerifyTokenPostEmailAlreadyVerifiedError

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class GenerateEmailVerifyTokenPostEmailAlreadyVerifiedError(APIResponse):
    status: str = 'EMAIL_ALREADY_VERIFIED_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class GenerateEmailVerifyTokenPostOkResult

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class GenerateEmailVerifyTokenPostOkResult(APIResponse):
    status: str = 'OK'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class GeneratePasswordResetTokenPostOkResult

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class GeneratePasswordResetTokenPostOkResult(APIResponse):
    status: str = 'OK'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class IsEmailVerifiedGetOkResult (is_verified: bool)

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class IsEmailVerifiedGetOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, is_verified: bool):
        self.is_verified = is_verified

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'isVerified': self.is_verified
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status,
        'isVerified': self.is_verified
    }
class PasswordResetPostInvalidTokenResponse

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class PasswordResetPostInvalidTokenResponse(APIResponse):
    status: str = 'RESET_PASSWORD_INVALID_TOKEN_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class PasswordResetPostOkResult (user_id: Union[str, None])

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class PasswordResetPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user_id: Union[str, None]):
        self.user_id = user_id

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class RecipeInterface

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class RecipeInterface(ABC):
    def __init__(self):
        pass

    @abstractmethod
    async def get_user_by_id(self, user_id: str, user_context: Dict[str, Any]) -> Union[User, None]:
        pass

    @abstractmethod
    async def get_user_by_email(self, email: str, user_context: Dict[str, Any]) -> Union[User, None]:
        pass

    @abstractmethod
    async def create_reset_password_token(self, user_id: str, user_context: Dict[str, Any]) -> Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]:
        pass

    @abstractmethod
    async def reset_password_using_token(self, token: str, new_password: str,
                                         user_context: Dict[str, Any]) -> Union[ResetPasswordUsingTokenOkResult, ResetPasswordUsingTokenInvalidTokenError]:
        pass

    @abstractmethod
    async def sign_in(self, email: str, password: str, user_context: Dict[str, Any]) -> Union[SignInOkResult, SignInWrongCredentialsError]:
        pass

    @abstractmethod
    async def sign_up(self, email: str, password: str, user_context: Dict[str, Any]) -> Union[SignUpOkResult, SignUpEmailAlreadyExistsError]:
        pass

    @abstractmethod
    async def update_email_or_password(self, user_id: str, email: Union[str, None],
                                       password: Union[str, None], user_context: Dict[str, Any]) -> Union[UpdateEmailOrPasswordOkResult, UpdateEmailOrPasswordEmailAlreadyExistsError, UpdateEmailOrPasswordUnknownUserIdError]:
        pass

Ancestors

  • abc.ABC

Subclasses

Methods

async def create_reset_password_token(self, user_id: str, user_context: Dict[str, Any]) ‑> Union[CreateResetPasswordOkResultCreateResetPasswordWrongUserIdError]
Expand source code
@abstractmethod
async def create_reset_password_token(self, user_id: str, user_context: Dict[str, Any]) -> Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]:
    pass
async def get_user_by_email(self, email: str, user_context: Dict[str, Any]) ‑> Union[User, None]
Expand source code
@abstractmethod
async def get_user_by_email(self, email: str, user_context: Dict[str, Any]) -> Union[User, None]:
    pass
async def get_user_by_id(self, user_id: str, user_context: Dict[str, Any]) ‑> Union[User, None]
Expand source code
@abstractmethod
async def get_user_by_id(self, user_id: str, user_context: Dict[str, Any]) -> Union[User, None]:
    pass
async def reset_password_using_token(self, token: str, new_password: str, user_context: Dict[str, Any]) ‑> Union[ResetPasswordUsingTokenOkResultResetPasswordUsingTokenInvalidTokenError]
Expand source code
@abstractmethod
async def reset_password_using_token(self, token: str, new_password: str,
                                     user_context: Dict[str, Any]) -> Union[ResetPasswordUsingTokenOkResult, ResetPasswordUsingTokenInvalidTokenError]:
    pass
async def sign_in(self, email: str, password: str, user_context: Dict[str, Any]) ‑> Union[SignInOkResultSignInWrongCredentialsError]
Expand source code
@abstractmethod
async def sign_in(self, email: str, password: str, user_context: Dict[str, Any]) -> Union[SignInOkResult, SignInWrongCredentialsError]:
    pass
async def sign_up(self, email: str, password: str, user_context: Dict[str, Any]) ‑> Union[SignUpOkResultSignUpEmailAlreadyExistsError]
Expand source code
@abstractmethod
async def sign_up(self, email: str, password: str, user_context: Dict[str, Any]) -> Union[SignUpOkResult, SignUpEmailAlreadyExistsError]:
    pass
async def update_email_or_password(self, user_id: str, email: Union[str, None], password: Union[str, None], user_context: Dict[str, Any]) ‑> Union[UpdateEmailOrPasswordOkResultUpdateEmailOrPasswordEmailAlreadyExistsErrorUpdateEmailOrPasswordUnknownUserIdError]
Expand source code
@abstractmethod
async def update_email_or_password(self, user_id: str, email: Union[str, None],
                                   password: Union[str, None], user_context: Dict[str, Any]) -> Union[UpdateEmailOrPasswordOkResult, UpdateEmailOrPasswordEmailAlreadyExistsError, UpdateEmailOrPasswordUnknownUserIdError]:
    pass
class ResetPasswordUsingTokenInvalidTokenError
Expand source code
class ResetPasswordUsingTokenInvalidTokenError():
    pass
class ResetPasswordUsingTokenOkResult (user_id: Union[str, None])
Expand source code
class ResetPasswordUsingTokenOkResult():
    def __init__(self, user_id: Union[str, None]):
        self.user_id = user_id
class SignInOkResult (user: User)
Expand source code
class SignInOkResult():
    def __init__(self, user: User):
        self.user = user
class SignInPostOkResult (user: User, session: SessionContainer)

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class SignInPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user: User, session: SessionContainer):
        self.user = user
        self.session = session

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'user': {
                'id': self.user.user_id,
                'email': self.user.email,
                'timeJoined': self.user.time_joined
            },
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status,
        'user': {
            'id': self.user.user_id,
            'email': self.user.email,
            'timeJoined': self.user.time_joined
        },
    }
class SignInPostWrongCredentialsError

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class SignInPostWrongCredentialsError(APIResponse):
    status: str = 'WRONG_CREDENTIALS_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class SignInWrongCredentialsError
Expand source code
class SignInWrongCredentialsError():
    pass
class SignUpEmailAlreadyExistsError
Expand source code
class SignUpEmailAlreadyExistsError():
    pass
class SignUpOkResult (user: User)
Expand source code
class SignUpOkResult():
    def __init__(self, user: User):
        self.user = user
class SignUpPostEmailAlreadyExistsError

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class SignUpPostEmailAlreadyExistsError(APIResponse):
    status: str = 'EMAIL_ALREADY_EXISTS_ERROR'

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status
    }
class SignUpPostOkResult (user: User, session: SessionContainer)

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class SignUpPostOkResult(APIResponse):
    status: str = 'OK'

    def __init__(self, user: User, session: SessionContainer):
        self.user = user
        self.session = session

    def to_json(self) -> Dict[str, Any]:
        return {
            'status': self.status,
            'user': {
                'id': self.user.user_id,
                'email': self.user.email,
                'timeJoined': self.user.time_joined
            },
        }

Ancestors

Class variables

var status : str

Methods

def to_json(self) ‑> Dict[str, Any]
Expand source code
def to_json(self) -> Dict[str, Any]:
    return {
        'status': self.status,
        'user': {
            'id': self.user.user_id,
            'email': self.user.email,
            'timeJoined': self.user.time_joined
        },
    }
class UpdateEmailOrPasswordEmailAlreadyExistsError
Expand source code
class UpdateEmailOrPasswordEmailAlreadyExistsError():
    pass
class UpdateEmailOrPasswordOkResult
Expand source code
class UpdateEmailOrPasswordOkResult():
    pass
class UpdateEmailOrPasswordUnknownUserIdError
Expand source code
class UpdateEmailOrPasswordUnknownUserIdError():
    pass