Module supertokens_python.recipe.usermetadata.interfaces

Expand source code
from abc import ABC, abstractmethod
from typing import Any, Dict

from typing_extensions import Literal


class MetadataResult(ABC):
    def __init__(self, status: Literal['OK'], metadata: Dict[str, Any]):
        self.status = status
        self.is_ok = status == 'OK'
        self.metadata = metadata


class ClearUserMetadataResult(ABC):
    def __init__(self, status: Literal['OK']):
        self.status = status
        self.is_ok = status == 'OK'


class RecipeInterface(ABC):
    @abstractmethod
    async def get_user_metadata(self, user_id: str, user_context: Dict[str, Any]) -> MetadataResult:
        pass

    @abstractmethod
    async def update_user_metadata(self, user_id: str, metadata_update: Dict[str, Any], user_context: Dict[str, Any]) -> MetadataResult:
        pass

    @abstractmethod
    async def clear_user_metadata(self, user_id: str, user_context: Dict[str, Any]) -> ClearUserMetadataResult:
        pass


class APIInterface(ABC):
    pass

Classes

class APIInterface

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

Expand source code
class APIInterface(ABC):
    pass

Ancestors

  • abc.ABC
class ClearUserMetadataResult (status: Literal['OK'])

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

Expand source code
class ClearUserMetadataResult(ABC):
    def __init__(self, status: Literal['OK']):
        self.status = status
        self.is_ok = status == 'OK'

Ancestors

  • abc.ABC
class MetadataResult (status: Literal['OK'], metadata: Dict[str, Any])

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

Expand source code
class MetadataResult(ABC):
    def __init__(self, status: Literal['OK'], metadata: Dict[str, Any]):
        self.status = status
        self.is_ok = status == 'OK'
        self.metadata = metadata

Ancestors

  • abc.ABC
class RecipeInterface

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

Expand source code
class RecipeInterface(ABC):
    @abstractmethod
    async def get_user_metadata(self, user_id: str, user_context: Dict[str, Any]) -> MetadataResult:
        pass

    @abstractmethod
    async def update_user_metadata(self, user_id: str, metadata_update: Dict[str, Any], user_context: Dict[str, Any]) -> MetadataResult:
        pass

    @abstractmethod
    async def clear_user_metadata(self, user_id: str, user_context: Dict[str, Any]) -> ClearUserMetadataResult:
        pass

Ancestors

  • abc.ABC

Subclasses

Methods

async def clear_user_metadata(self, user_id: str, user_context: Dict[str, Any]) ‑> ClearUserMetadataResult
Expand source code
@abstractmethod
async def clear_user_metadata(self, user_id: str, user_context: Dict[str, Any]) -> ClearUserMetadataResult:
    pass
async def get_user_metadata(self, user_id: str, user_context: Dict[str, Any]) ‑> MetadataResult
Expand source code
@abstractmethod
async def get_user_metadata(self, user_id: str, user_context: Dict[str, Any]) -> MetadataResult:
    pass
async def update_user_metadata(self, user_id: str, metadata_update: Dict[str, Any], user_context: Dict[str, Any]) ‑> MetadataResult
Expand source code
@abstractmethod
async def update_user_metadata(self, user_id: str, metadata_update: Dict[str, Any], user_context: Dict[str, Any]) -> MetadataResult:
    pass