Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/datadog_api_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def __init__(
settings: Dict[str, Any],
params_map: Dict[str, Dict[str, Any]],
headers_map: Dict[str, List[str]],
api_client: ApiClient,
api_client: "ApiClient",
):
"""Creates an endpoint.

Expand Down
11 changes: 8 additions & 3 deletions src/datadog_api_client/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,14 +1708,19 @@ def set_attribute_from_path(obj, path, value, params_map):
"""Set an attribute at `path` with the given value."""
elts = path.split(".")
last = elts.pop(-1)
cur = obj
root = None
# Drill down for nested dictionaries/classes
for i, elt in enumerate(elts):
if i:
root = root.openapi_types[elt][0]
else:
root = params_map[elt]["openapi_types"][0]
# Try to drill deeper. If missing, assign new root.
try:
obj = obj[elt]
next_obj = cur[elt]
except (KeyError, AttributeError):
obj = root()
obj[last] = value
next_obj = root()
cur[elt] = next_obj
cur = next_obj
cur[last] = value
7 changes: 4 additions & 3 deletions src/datadog_api_client/v2/api/incidents_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1657,14 +1657,15 @@ def list_incidents_with_pagination(
kwargs: Dict[str, Any] = {}
if include is not unset:
kwargs["include"] = include

if page_size is not unset:
kwargs["page_size"] = page_size

local_page_size = page_size
else:
# Avoids the extra call to get_attribute_from_path in the default case.
local_page_size = 10
if page_offset is not unset:
kwargs["page_offset"] = page_offset

local_page_size = get_attribute_from_path(kwargs, "page_size", 10)
endpoint = self._list_incidents_endpoint
set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map)
pagination = {
Expand Down