mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 19:30:47 +08:00
25 lines
560 B
Python
25 lines
560 B
Python
import sys
|
|
from datetime import datetime
|
|
from typing import TypeVar
|
|
|
|
if sys.version_info < (3, 8):
|
|
from typing_extensions import Protocol # pragma: no cover
|
|
else:
|
|
from typing import Protocol # pragma: no cover
|
|
|
|
from fastapi_users import models
|
|
|
|
|
|
class AccessTokenProtocol(Protocol[models.ID]):
|
|
"""Access token protocol that ORM model should follow."""
|
|
|
|
token: str
|
|
user_id: models.ID
|
|
created_at: datetime
|
|
|
|
def __init__(self, *args, **kwargs) -> None:
|
|
... # pragma: no cover
|
|
|
|
|
|
AP = TypeVar("AP", bound=AccessTokenProtocol)
|