2023-01-15 10:36:00 +01:00
|
|
|
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
|
|
|
|
|
|
|
2023-07-19 10:49:37 +02:00
|
|
|
class Query(GenerateSchematicABC):
|
2023-01-15 10:36:00 +01:00
|
|
|
def __init__(self, *args: str):
|
|
|
|
GenerateSchematicABC.__init__(self, *args)
|
|
|
|
|
|
|
|
def get_code(self) -> str:
|
|
|
|
import textwrap
|
|
|
|
|
|
|
|
code = textwrap.dedent(
|
|
|
|
"""\
|
|
|
|
from bot_graphql.abc.data_query_abc import DataQueryABC
|
|
|
|
|
|
|
|
|
|
|
|
class $ClassName(DataQueryABC):
|
|
|
|
def __init__(self):
|
|
|
|
DataQueryABC.__init__(self, "Name")
|
|
|
|
|
|
|
|
self.set_field("id", self.resolve_id)
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def resolve_id(x, *_):
|
|
|
|
return x.id
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
return self.build_code_str(
|
|
|
|
code,
|
|
|
|
ClassName=self._class_name,
|
|
|
|
)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def register(cls):
|
|
|
|
GenerateSchematicABC.register(cls, "query", [])
|