Introducing UncompleteZoneMeta to solve inconsistent API on zone_history

Closes: https://github.com/happyDomain/python-sdk/issues/1
This commit is contained in:
nemunaire 2023-05-02 20:36:53 +02:00
parent 7325b3956b
commit a62e5f1a59
3 changed files with 55 additions and 4 deletions

View file

@ -2,11 +2,11 @@ import json
from urllib.parse import quote
from .error import HappyError
from .zone import ZoneMeta, Zone
from .zone import UncompleteZoneMeta, ZoneMeta, Zone
class Domain:
def __init__(self, _session, id, id_owner, id_provider, domain, zone_history, group=""):
def __init__(self, _session, id, id_owner, id_provider, domain, zone_history, zone_history_are_ids=False, group=""):
self._session = _session
self.id = id
@ -14,7 +14,10 @@ class Domain:
self.id_provider = id_provider
self.domain = domain
self.group = group
self.zone_history = zone_history if zone_history is not None else []
if zone_history_are_ids:
self.zone_history = [UncompleteZoneMeta(self, zid) for zid in zone_history]
else:
self.zone_history = zone_history if zone_history is not None else []
def _dumps(self):
return json.dumps({