Module supertokens_python.recipe.usermetadata.interfaces

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


class MetadataResult(ABC):
    def __init__(self, metadata: Dict[str, Any]):
        self.metadata = metadata


class ClearUserMetadataResult:
    pass


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
Expand source code
class ClearUserMetadataResult:
    pass
class MetadataResult (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, metadata: Dict[str, Any]):
        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
async def get_user_metadata(self, user_id: str, user_context: Dict[str, Any]) ‑> MetadataResult
async def update_user_metadata(self, user_id: str, metadata_update: Dict[str, Any], user_context: Dict[str, Any]) ‑> MetadataResult