Module dcso.portal.abstracts
Definitions of abstract base classes used throughout the dcso.portal
module.
Expand source code
# Copyright (c) 2020, DCSO GmbH
"""
Definitions of abstract base classes used throughout the `dcso.portal` module.
"""
from abc import ABCMeta, abstractmethod
from collections import namedtuple
from typing import List, Optional
class APIAbstract(metaclass=ABCMeta):
@property
@abstractmethod
def api_url(self) -> str:
raise NotImplemented
@api_url.setter
@abstractmethod
def api_url(self, url: str) -> None:
raise NotImplemented
@property
@abstractmethod
def token(self) -> str:
raise NotImplemented
@token.setter
@abstractmethod
def token(self, token: str) -> None:
raise NotImplemented
@abstractmethod
def execute_graphql(self, query: str,
variables: Optional[dict] = None,
fragments: Optional[List[str]] = None) -> namedtuple:
raise NotImplemented
class ServiceAbstract(metaclass=ABCMeta):
@property
@abstractmethod
def _api(self) -> APIAbstract:
pass
@_api.setter
@abstractmethod
def _api(self, url: str) -> None:
raise NotImplemented
Classes
class APIAbstract
-
Expand source code
class APIAbstract(metaclass=ABCMeta): @property @abstractmethod def api_url(self) -> str: raise NotImplemented @api_url.setter @abstractmethod def api_url(self, url: str) -> None: raise NotImplemented @property @abstractmethod def token(self) -> str: raise NotImplemented @token.setter @abstractmethod def token(self, token: str) -> None: raise NotImplemented @abstractmethod def execute_graphql(self, query: str, variables: Optional[dict] = None, fragments: Optional[List[str]] = None) -> namedtuple: raise NotImplemented
Subclasses
Instance variables
var api_url : str
-
Expand source code
@property @abstractmethod def api_url(self) -> str: raise NotImplemented
var token : str
-
Expand source code
@property @abstractmethod def token(self) -> str: raise NotImplemented
Methods
def execute_graphql(self, query: str, variables: Union[dict, NoneType] = None, fragments: Union[List[str], NoneType] = None) ‑>
-
Expand source code
@abstractmethod def execute_graphql(self, query: str, variables: Optional[dict] = None, fragments: Optional[List[str]] = None) -> namedtuple: raise NotImplemented
class ServiceAbstract
-
Expand source code
class ServiceAbstract(metaclass=ABCMeta): @property @abstractmethod def _api(self) -> APIAbstract: pass @_api.setter @abstractmethod def _api(self, url: str) -> None: raise NotImplemented
Subclasses