Merge branch 'v20260203-11-autotask-resolution-get-put-required-fields' into main
This commit is contained in:
commit
02d7bdd5b8
@ -1 +1 @@
|
|||||||
v20260203-10-autotask-resolution-field-aliases
|
v20260203-11-autotask-resolution-get-put-required-fields
|
||||||
|
|||||||
@ -605,9 +605,27 @@ class AutotaskClient:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def _get_first(ticket_obj: Dict[str, Any], keys: list[str]) -> Any:
|
def _get_first(ticket_obj: Dict[str, Any], keys: list[str]) -> Any:
|
||||||
|
"""Return first matching value for any of the given keys.
|
||||||
|
|
||||||
|
Autotask field casing / suffixes can vary by tenant and API surface.
|
||||||
|
We therefore try direct lookups first and then fall back to a
|
||||||
|
case-insensitive scan of the ticket payload keys.
|
||||||
|
"""
|
||||||
|
if not isinstance(ticket_obj, dict):
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Direct lookups (fast path)
|
||||||
for k in keys:
|
for k in keys:
|
||||||
if k in ticket_obj:
|
if k in ticket_obj:
|
||||||
return ticket_obj.get(k)
|
return ticket_obj.get(k)
|
||||||
|
|
||||||
|
# Case-insensitive fallback
|
||||||
|
lower_map = {str(k).lower(): k for k in ticket_obj.keys()}
|
||||||
|
for k in keys:
|
||||||
|
lk = str(k).lower()
|
||||||
|
if lk in lower_map:
|
||||||
|
return ticket_obj.get(lower_map[lk])
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
stabilising_fields = list(field_sources.keys())
|
stabilising_fields = list(field_sources.keys())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user