From 4751925178efacecdeb015103786a56f611748df Mon Sep 17 00:00:00 2001 From: brodokk Date: Tue, 27 Jun 2023 07:00:26 +0000 Subject: [PATCH 1/2] Add support of field relashionsips on egg I also set a default values for the optional fields since a field must have a default value when using dataclass. --- pytero/types.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pytero/types.py b/pytero/types.py index c690f5f..0de437f 100644 --- a/pytero/types.py +++ b/pytero/types.py @@ -20,6 +20,7 @@ 'DeployServerOptions', 'EggScript', 'EggConfiguration', + 'EggRelashionships', 'Egg', 'FeatureLimits', 'Limits', @@ -214,6 +215,16 @@ def to_dict(self) -> dict[str, Any]: return self.__dict__ +@dataclass +class EggRelashionships: + config: dict + script: dict + variables: dict + + def to_dict(self) -> dict[str, Any]: + return self.__dict__ + + @dataclass class Egg: id: int @@ -229,7 +240,8 @@ class Egg: startup: str script: EggScript created_at: str - updated_at: Optional[str] + updated_at: Optional[str] = None + relationships: Optional[dict] = None def __repr__(self) -> str: return f'' From 9fd682fd3ddbb541cbb165a0da24a7249c600cda Mon Sep 17 00:00:00 2001 From: brodokk Date: Mon, 3 Jul 2023 06:49:39 +0000 Subject: [PATCH 2/2] Don't add a not usable class --- pytero/types.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pytero/types.py b/pytero/types.py index 0de437f..3b51e00 100644 --- a/pytero/types.py +++ b/pytero/types.py @@ -20,7 +20,6 @@ 'DeployServerOptions', 'EggScript', 'EggConfiguration', - 'EggRelashionships', 'Egg', 'FeatureLimits', 'Limits', @@ -215,16 +214,6 @@ def to_dict(self) -> dict[str, Any]: return self.__dict__ -@dataclass -class EggRelashionships: - config: dict - script: dict - variables: dict - - def to_dict(self) -> dict[str, Any]: - return self.__dict__ - - @dataclass class Egg: id: int