selfprivacy-rest-api/selfprivacy_api/graphql/queries/api.py

28 lines
652 B
Python
Raw Normal View History

2022-06-24 12:26:51 +00:00
"""API access status"""
2022-06-24 13:05:18 +00:00
# pylint: disable=too-few-public-methods
2022-06-24 12:26:51 +00:00
import datetime
import typing
import strawberry
2022-06-24 15:13:54 +00:00
from selfprivacy_api.resolvers.api import get_api_version
2022-06-24 13:05:18 +00:00
2022-06-24 12:26:51 +00:00
@strawberry.type
class ApiDevice:
name: str
creation_date: datetime.datetime
is_caller: bool
@strawberry.type
class ApiRecoveryKeyStatus:
exists: bool
valid: bool
creation_date: datetime.datetime
expiration_date: typing.Optional[datetime.datetime]
uses_left: typing.Optional[int]
@strawberry.type
class Api:
2022-06-24 13:05:18 +00:00
version: str = strawberry.field(resolver=get_api_version)
2022-06-24 12:26:51 +00:00
devices: typing.List[ApiDevice]
recovery_key: ApiRecoveryKeyStatus