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
15 changes: 11 additions & 4 deletions 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 Expand Up @@ -778,9 +778,16 @@ def _validate_and_get_host(self, kwargs):
return host

def call_with_http_info(self, **kwargs):
host = self._validate_and_get_host(kwargs)

params = self.gather_params(kwargs)
# Fastpath optimization: Avoid unnecessary dict creation for single param endpoints
param_keys = list(kwargs.keys())
if len(param_keys) == 1:
key = param_keys[0]
value = kwargs[key]
host = self._validate_and_get_host({key: value})
params = self.gather_params({key: value})
else:
host = self._validate_and_get_host(kwargs)
params = self.gather_params(kwargs)

return self.api_client.call_api(
self.settings["endpoint_path"],
Expand Down
6 changes: 2 additions & 4 deletions src/datadog_api_client/v2/api/cloud_cost_management_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,10 +1150,8 @@ def get_custom_costs_file(
:type file_id: str
:rtype: CustomCostsFileGetResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["file_id"] = file_id

return self._get_custom_costs_file_endpoint.call_with_http_info(**kwargs)
# Fastpath: Directly pass parameter, avoid dict creation assignment
return self._get_custom_costs_file_endpoint.call_with_http_info(file_id=file_id)

def get_ruleset(
self,
Expand Down