diff --git a/src/datadog_api_client/api_client.py b/src/datadog_api_client/api_client.py index d9794ede9c..4d597f61a4 100644 --- a/src/datadog_api_client/api_client.py +++ b/src/datadog_api_client/api_client.py @@ -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. @@ -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"], diff --git a/src/datadog_api_client/v2/api/cloud_cost_management_api.py b/src/datadog_api_client/v2/api/cloud_cost_management_api.py index 48e93f5955..b97b3d98e4 100644 --- a/src/datadog_api_client/v2/api/cloud_cost_management_api.py +++ b/src/datadog_api_client/v2/api/cloud_cost_management_api.py @@ -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,