2022-06-24 20:12:32 +03:00
|
|
|
"""GraphQL API for SelfPrivacy."""
|
|
|
|
# pylint: disable=too-few-public-methods
|
2022-07-23 12:39:52 +03:00
|
|
|
|
2022-06-24 20:12:32 +03:00
|
|
|
import strawberry
|
2022-06-29 20:39:46 +03:00
|
|
|
from selfprivacy_api.graphql import IsAuthenticated
|
|
|
|
from selfprivacy_api.graphql.mutations.api_mutations import ApiMutations
|
2022-07-27 20:06:20 +03:00
|
|
|
from selfprivacy_api.graphql.mutations.ssh_mutations import SshMutations
|
2022-07-25 17:08:31 +03:00
|
|
|
from selfprivacy_api.graphql.mutations.storage_mutation import StorageMutations
|
2022-07-12 16:24:29 +03:00
|
|
|
from selfprivacy_api.graphql.mutations.system_mutations import SystemMutations
|
2022-06-24 20:12:32 +03:00
|
|
|
|
2022-06-29 20:39:46 +03:00
|
|
|
from selfprivacy_api.graphql.queries.api_queries import Api
|
2022-07-25 17:08:31 +03:00
|
|
|
from selfprivacy_api.graphql.queries.storage import Storage
|
2022-06-24 20:12:32 +03:00
|
|
|
from selfprivacy_api.graphql.queries.system import System
|
|
|
|
|
2022-07-23 12:39:52 +03:00
|
|
|
from selfprivacy_api.graphql.mutations.users_mutations import UserMutations
|
2022-07-24 18:38:39 +03:00
|
|
|
from selfprivacy_api.graphql.queries.users import Users
|
2022-06-24 20:12:32 +03:00
|
|
|
|
2022-07-25 02:59:43 +03:00
|
|
|
|
2022-06-24 20:12:32 +03:00
|
|
|
@strawberry.type
|
|
|
|
class Query:
|
|
|
|
"""Root schema for queries"""
|
2022-06-24 21:14:20 +03:00
|
|
|
|
2022-06-29 20:39:46 +03:00
|
|
|
@strawberry.field(permission_classes=[IsAuthenticated])
|
2022-06-24 21:18:21 +03:00
|
|
|
def system(self) -> System:
|
|
|
|
"""System queries"""
|
|
|
|
return System()
|
2022-06-24 21:14:20 +03:00
|
|
|
|
2022-06-24 20:12:32 +03:00
|
|
|
@strawberry.field
|
|
|
|
def api(self) -> Api:
|
|
|
|
"""API access status"""
|
|
|
|
return Api()
|
|
|
|
|
2022-07-25 20:30:54 +03:00
|
|
|
@strawberry.field(permission_classes=[IsAuthenticated])
|
2022-07-23 12:39:52 +03:00
|
|
|
def users(self) -> Users:
|
|
|
|
"""Users queries"""
|
|
|
|
return Users()
|
|
|
|
|
2022-07-25 17:08:31 +03:00
|
|
|
@strawberry.field(permission_classes=[IsAuthenticated])
|
|
|
|
def storage(self) -> Storage:
|
|
|
|
"""Storage queries"""
|
|
|
|
return Storage()
|
|
|
|
|
2022-07-07 16:53:19 +03:00
|
|
|
|
2022-06-29 20:39:46 +03:00
|
|
|
@strawberry.type
|
2022-07-23 12:39:52 +03:00
|
|
|
class Mutation(
|
|
|
|
ApiMutations,
|
|
|
|
SystemMutations,
|
|
|
|
UserMutations,
|
2022-07-27 20:06:20 +03:00
|
|
|
SshMutations,
|
2022-07-30 18:39:09 +03:00
|
|
|
StorageMutations,
|
2022-07-23 12:39:52 +03:00
|
|
|
):
|
2022-06-29 20:39:46 +03:00
|
|
|
"""Root schema for mutations"""
|
2022-07-07 16:53:19 +03:00
|
|
|
|
2022-06-29 20:39:46 +03:00
|
|
|
pass
|
2022-06-24 21:14:20 +03:00
|
|
|
|
2022-07-07 16:53:19 +03:00
|
|
|
|
2022-06-29 20:39:46 +03:00
|
|
|
schema = strawberry.Schema(query=Query, mutation=Mutation)
|