diff --git a/algoliasearch/abtesting/client.py b/algoliasearch/abtesting/client.py index 93f26899f..f43bd57b8 100644 --- a/algoliasearch/abtesting/client.py +++ b/algoliasearch/abtesting/client.py @@ -79,9 +79,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: AbtestingConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: AbtestingConfig, transporter: Optional[Transporter] = None + ) -> AbtestingClient: """Allows creating a client with a customized `AbtestingConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -106,7 +107,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -173,11 +174,10 @@ async def add_ab_tests( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTestResponse' result object. """ - return ( - await self.add_ab_tests_with_http_info( - add_ab_tests_request, request_options - ) - ).deserialize(ABTestResponse) + resp = await self.add_ab_tests_with_http_info( + add_ab_tests_request, request_options + ) + return resp.deserialize(ABTestResponse, resp.raw_data) async def custom_delete_with_http_info( self, @@ -251,9 +251,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -325,9 +326,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -416,11 +416,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -509,11 +508,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_ab_test_with_http_info( self, @@ -562,9 +560,8 @@ async def delete_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTestResponse' result object. """ - return ( - await self.delete_ab_test_with_http_info(id, request_options) - ).deserialize(ABTestResponse) + resp = await self.delete_ab_test_with_http_info(id, request_options) + return resp.deserialize(ABTestResponse, resp.raw_data) async def get_ab_test_with_http_info( self, @@ -611,9 +608,8 @@ async def get_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTest' result object. """ - return (await self.get_ab_test_with_http_info(id, request_options)).deserialize( - ABTest - ) + resp = await self.get_ab_test_with_http_info(id, request_options) + return resp.deserialize(ABTest, resp.raw_data) async def list_ab_tests_with_http_info( self, @@ -717,11 +713,10 @@ async def list_ab_tests( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListABTestsResponse' result object. """ - return ( - await self.list_ab_tests_with_http_info( - offset, limit, index_prefix, index_suffix, request_options - ) - ).deserialize(ListABTestsResponse) + resp = await self.list_ab_tests_with_http_info( + offset, limit, index_prefix, index_suffix, request_options + ) + return resp.deserialize(ListABTestsResponse, resp.raw_data) async def schedule_ab_test_with_http_info( self, @@ -775,11 +770,10 @@ async def schedule_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ScheduleABTestResponse' result object. """ - return ( - await self.schedule_ab_test_with_http_info( - schedule_ab_tests_request, request_options - ) - ).deserialize(ScheduleABTestResponse) + resp = await self.schedule_ab_test_with_http_info( + schedule_ab_tests_request, request_options + ) + return resp.deserialize(ScheduleABTestResponse, resp.raw_data) async def stop_ab_test_with_http_info( self, @@ -826,9 +820,8 @@ async def stop_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTestResponse' result object. """ - return ( - await self.stop_ab_test_with_http_info(id, request_options) - ).deserialize(ABTestResponse) + resp = await self.stop_ab_test_with_http_info(id, request_options) + return resp.deserialize(ABTestResponse, resp.raw_data) class AbtestingClientSync: @@ -873,9 +866,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: AbtestingConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: AbtestingConfig, transporter: Optional[TransporterSync] = None + ) -> AbtestingClientSync: """Allows creating a client with a customized `AbtestingConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -966,9 +960,8 @@ def add_ab_tests( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTestResponse' result object. """ - return ( - self.add_ab_tests_with_http_info(add_ab_tests_request, request_options) - ).deserialize(ABTestResponse) + resp = self.add_ab_tests_with_http_info(add_ab_tests_request, request_options) + return resp.deserialize(ABTestResponse, resp.raw_data) def custom_delete_with_http_info( self, @@ -1042,9 +1035,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -1116,9 +1108,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -1207,9 +1198,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -1298,9 +1288,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_ab_test_with_http_info( self, @@ -1349,9 +1338,8 @@ def delete_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTestResponse' result object. """ - return (self.delete_ab_test_with_http_info(id, request_options)).deserialize( - ABTestResponse - ) + resp = self.delete_ab_test_with_http_info(id, request_options) + return resp.deserialize(ABTestResponse, resp.raw_data) def get_ab_test_with_http_info( self, @@ -1398,9 +1386,8 @@ def get_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTest' result object. """ - return (self.get_ab_test_with_http_info(id, request_options)).deserialize( - ABTest - ) + resp = self.get_ab_test_with_http_info(id, request_options) + return resp.deserialize(ABTest, resp.raw_data) def list_ab_tests_with_http_info( self, @@ -1504,11 +1491,10 @@ def list_ab_tests( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListABTestsResponse' result object. """ - return ( - self.list_ab_tests_with_http_info( - offset, limit, index_prefix, index_suffix, request_options - ) - ).deserialize(ListABTestsResponse) + resp = self.list_ab_tests_with_http_info( + offset, limit, index_prefix, index_suffix, request_options + ) + return resp.deserialize(ListABTestsResponse, resp.raw_data) def schedule_ab_test_with_http_info( self, @@ -1562,11 +1548,10 @@ def schedule_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ScheduleABTestResponse' result object. """ - return ( - self.schedule_ab_test_with_http_info( - schedule_ab_tests_request, request_options - ) - ).deserialize(ScheduleABTestResponse) + resp = self.schedule_ab_test_with_http_info( + schedule_ab_tests_request, request_options + ) + return resp.deserialize(ScheduleABTestResponse, resp.raw_data) def stop_ab_test_with_http_info( self, @@ -1613,6 +1598,5 @@ def stop_ab_test( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ABTestResponse' result object. """ - return (self.stop_ab_test_with_http_info(id, request_options)).deserialize( - ABTestResponse - ) + resp = self.stop_ab_test_with_http_info(id, request_options) + return resp.deserialize(ABTestResponse, resp.raw_data) diff --git a/algoliasearch/analytics/client.py b/algoliasearch/analytics/client.py index 7ddc4b7cd..81a6eadf4 100644 --- a/algoliasearch/analytics/client.py +++ b/algoliasearch/analytics/client.py @@ -125,9 +125,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: AnalyticsConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: AnalyticsConfig, transporter: Optional[Transporter] = None + ) -> AnalyticsClient: """Allows creating a client with a customized `AnalyticsConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -152,7 +153,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -239,9 +240,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -313,9 +315,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -404,11 +405,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -497,11 +497,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def get_add_to_cart_rate_with_http_info( self, @@ -610,11 +609,10 @@ async def get_add_to_cart_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetAddToCartRateResponse' result object. """ - return ( - await self.get_add_to_cart_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetAddToCartRateResponse) + resp = await self.get_add_to_cart_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetAddToCartRateResponse, resp.raw_data) async def get_average_click_position_with_http_info( self, @@ -723,11 +721,10 @@ async def get_average_click_position( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetAverageClickPositionResponse' result object. """ - return ( - await self.get_average_click_position_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetAverageClickPositionResponse) + resp = await self.get_average_click_position_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetAverageClickPositionResponse, resp.raw_data) async def get_click_positions_with_http_info( self, @@ -836,11 +833,10 @@ async def get_click_positions( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetClickPositionsResponse' result object. """ - return ( - await self.get_click_positions_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetClickPositionsResponse) + resp = await self.get_click_positions_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetClickPositionsResponse, resp.raw_data) async def get_click_through_rate_with_http_info( self, @@ -949,11 +945,10 @@ async def get_click_through_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetClickThroughRateResponse' result object. """ - return ( - await self.get_click_through_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetClickThroughRateResponse) + resp = await self.get_click_through_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetClickThroughRateResponse, resp.raw_data) async def get_conversion_rate_with_http_info( self, @@ -1062,11 +1057,10 @@ async def get_conversion_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetConversionRateResponse' result object. """ - return ( - await self.get_conversion_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetConversionRateResponse) + resp = await self.get_conversion_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetConversionRateResponse, resp.raw_data) async def get_no_click_rate_with_http_info( self, @@ -1175,11 +1169,10 @@ async def get_no_click_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetNoClickRateResponse' result object. """ - return ( - await self.get_no_click_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetNoClickRateResponse) + resp = await self.get_no_click_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetNoClickRateResponse, resp.raw_data) async def get_no_results_rate_with_http_info( self, @@ -1288,11 +1281,10 @@ async def get_no_results_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetNoResultsRateResponse' result object. """ - return ( - await self.get_no_results_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetNoResultsRateResponse) + resp = await self.get_no_results_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetNoResultsRateResponse, resp.raw_data) async def get_purchase_rate_with_http_info( self, @@ -1401,11 +1393,10 @@ async def get_purchase_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetPurchaseRateResponse' result object. """ - return ( - await self.get_purchase_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetPurchaseRateResponse) + resp = await self.get_purchase_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetPurchaseRateResponse, resp.raw_data) async def get_revenue_with_http_info( self, @@ -1514,11 +1505,10 @@ async def get_revenue( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetRevenue' result object. """ - return ( - await self.get_revenue_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetRevenue) + resp = await self.get_revenue_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetRevenue, resp.raw_data) async def get_searches_count_with_http_info( self, @@ -1627,11 +1617,10 @@ async def get_searches_count( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetSearchesCountResponse' result object. """ - return ( - await self.get_searches_count_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetSearchesCountResponse) + resp = await self.get_searches_count_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetSearchesCountResponse, resp.raw_data) async def get_searches_no_clicks_with_http_info( self, @@ -1766,11 +1755,10 @@ async def get_searches_no_clicks( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetSearchesNoClicksResponse' result object. """ - return ( - await self.get_searches_no_clicks_with_http_info( - index, start_date, end_date, limit, offset, tags, request_options - ) - ).deserialize(GetSearchesNoClicksResponse) + resp = await self.get_searches_no_clicks_with_http_info( + index, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetSearchesNoClicksResponse, resp.raw_data) async def get_searches_no_results_with_http_info( self, @@ -1905,11 +1893,10 @@ async def get_searches_no_results( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetSearchesNoResultsResponse' result object. """ - return ( - await self.get_searches_no_results_with_http_info( - index, start_date, end_date, limit, offset, tags, request_options - ) - ).deserialize(GetSearchesNoResultsResponse) + resp = await self.get_searches_no_results_with_http_info( + index, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetSearchesNoResultsResponse, resp.raw_data) async def get_status_with_http_info( self, @@ -1962,9 +1949,8 @@ async def get_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetStatusResponse' result object. """ - return ( - await self.get_status_with_http_info(index, request_options) - ).deserialize(GetStatusResponse) + resp = await self.get_status_with_http_info(index, request_options) + return resp.deserialize(GetStatusResponse, resp.raw_data) async def get_top_countries_with_http_info( self, @@ -2099,11 +2085,10 @@ async def get_top_countries( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopCountriesResponse' result object. """ - return ( - await self.get_top_countries_with_http_info( - index, start_date, end_date, limit, offset, tags, request_options - ) - ).deserialize(GetTopCountriesResponse) + resp = await self.get_top_countries_with_http_info( + index, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetTopCountriesResponse, resp.raw_data) async def get_top_filter_attributes_with_http_info( self, @@ -2250,18 +2235,10 @@ async def get_top_filter_attributes( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopFilterAttributesResponse' result object. """ - return ( - await self.get_top_filter_attributes_with_http_info( - index, - search, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopFilterAttributesResponse) + resp = await self.get_top_filter_attributes_with_http_info( + index, search, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetTopFilterAttributesResponse, resp.raw_data) async def get_top_filter_for_attribute_with_http_info( self, @@ -2421,19 +2398,18 @@ async def get_top_filter_for_attribute( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopFilterForAttributeResponse' result object. """ - return ( - await self.get_top_filter_for_attribute_with_http_info( - attribute, - index, - search, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopFilterForAttributeResponse) + resp = await self.get_top_filter_for_attribute_with_http_info( + attribute, + index, + search, + start_date, + end_date, + limit, + offset, + tags, + request_options, + ) + return resp.deserialize(GetTopFilterForAttributeResponse, resp.raw_data) async def get_top_filters_no_results_with_http_info( self, @@ -2580,18 +2556,10 @@ async def get_top_filters_no_results( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopFiltersNoResultsResponse' result object. """ - return ( - await self.get_top_filters_no_results_with_http_info( - index, - search, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopFiltersNoResultsResponse) + resp = await self.get_top_filters_no_results_with_http_info( + index, search, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetTopFiltersNoResultsResponse, resp.raw_data) async def get_top_hits_with_http_info( self, @@ -2774,20 +2742,19 @@ async def get_top_hits( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopHitsResponse' result object. """ - return ( - await self.get_top_hits_with_http_info( - index, - search, - click_analytics, - revenue_analytics, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopHitsResponse) + resp = await self.get_top_hits_with_http_info( + index, + search, + click_analytics, + revenue_analytics, + start_date, + end_date, + limit, + offset, + tags, + request_options, + ) + return resp.deserialize(GetTopHitsResponse, resp.raw_data) async def get_top_searches_with_http_info( self, @@ -2994,21 +2961,20 @@ async def get_top_searches( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopSearchesResponse' result object. """ - return ( - await self.get_top_searches_with_http_info( - index, - click_analytics, - revenue_analytics, - start_date, - end_date, - order_by, - direction, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopSearchesResponse) + resp = await self.get_top_searches_with_http_info( + index, + click_analytics, + revenue_analytics, + start_date, + end_date, + order_by, + direction, + limit, + offset, + tags, + request_options, + ) + return resp.deserialize(GetTopSearchesResponse, resp.raw_data) async def get_users_count_with_http_info( self, @@ -3117,11 +3083,10 @@ async def get_users_count( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetUsersCountResponse' result object. """ - return ( - await self.get_users_count_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetUsersCountResponse) + resp = await self.get_users_count_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetUsersCountResponse, resp.raw_data) class AnalyticsClientSync: @@ -3166,9 +3131,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: AnalyticsConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: AnalyticsConfig, transporter: Optional[TransporterSync] = None + ) -> AnalyticsClientSync: """Allows creating a client with a customized `AnalyticsConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -3279,9 +3245,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -3353,9 +3318,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -3444,9 +3408,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -3535,9 +3498,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def get_add_to_cart_rate_with_http_info( self, @@ -3646,11 +3608,10 @@ def get_add_to_cart_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetAddToCartRateResponse' result object. """ - return ( - self.get_add_to_cart_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetAddToCartRateResponse) + resp = self.get_add_to_cart_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetAddToCartRateResponse, resp.raw_data) def get_average_click_position_with_http_info( self, @@ -3759,11 +3720,10 @@ def get_average_click_position( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetAverageClickPositionResponse' result object. """ - return ( - self.get_average_click_position_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetAverageClickPositionResponse) + resp = self.get_average_click_position_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetAverageClickPositionResponse, resp.raw_data) def get_click_positions_with_http_info( self, @@ -3872,11 +3832,10 @@ def get_click_positions( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetClickPositionsResponse' result object. """ - return ( - self.get_click_positions_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetClickPositionsResponse) + resp = self.get_click_positions_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetClickPositionsResponse, resp.raw_data) def get_click_through_rate_with_http_info( self, @@ -3985,11 +3944,10 @@ def get_click_through_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetClickThroughRateResponse' result object. """ - return ( - self.get_click_through_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetClickThroughRateResponse) + resp = self.get_click_through_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetClickThroughRateResponse, resp.raw_data) def get_conversion_rate_with_http_info( self, @@ -4098,11 +4056,10 @@ def get_conversion_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetConversionRateResponse' result object. """ - return ( - self.get_conversion_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetConversionRateResponse) + resp = self.get_conversion_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetConversionRateResponse, resp.raw_data) def get_no_click_rate_with_http_info( self, @@ -4211,11 +4168,10 @@ def get_no_click_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetNoClickRateResponse' result object. """ - return ( - self.get_no_click_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetNoClickRateResponse) + resp = self.get_no_click_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetNoClickRateResponse, resp.raw_data) def get_no_results_rate_with_http_info( self, @@ -4324,11 +4280,10 @@ def get_no_results_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetNoResultsRateResponse' result object. """ - return ( - self.get_no_results_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetNoResultsRateResponse) + resp = self.get_no_results_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetNoResultsRateResponse, resp.raw_data) def get_purchase_rate_with_http_info( self, @@ -4437,11 +4392,10 @@ def get_purchase_rate( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetPurchaseRateResponse' result object. """ - return ( - self.get_purchase_rate_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetPurchaseRateResponse) + resp = self.get_purchase_rate_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetPurchaseRateResponse, resp.raw_data) def get_revenue_with_http_info( self, @@ -4550,11 +4504,10 @@ def get_revenue( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetRevenue' result object. """ - return ( - self.get_revenue_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetRevenue) + resp = self.get_revenue_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetRevenue, resp.raw_data) def get_searches_count_with_http_info( self, @@ -4663,11 +4616,10 @@ def get_searches_count( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetSearchesCountResponse' result object. """ - return ( - self.get_searches_count_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetSearchesCountResponse) + resp = self.get_searches_count_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetSearchesCountResponse, resp.raw_data) def get_searches_no_clicks_with_http_info( self, @@ -4802,11 +4754,10 @@ def get_searches_no_clicks( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetSearchesNoClicksResponse' result object. """ - return ( - self.get_searches_no_clicks_with_http_info( - index, start_date, end_date, limit, offset, tags, request_options - ) - ).deserialize(GetSearchesNoClicksResponse) + resp = self.get_searches_no_clicks_with_http_info( + index, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetSearchesNoClicksResponse, resp.raw_data) def get_searches_no_results_with_http_info( self, @@ -4941,11 +4892,10 @@ def get_searches_no_results( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetSearchesNoResultsResponse' result object. """ - return ( - self.get_searches_no_results_with_http_info( - index, start_date, end_date, limit, offset, tags, request_options - ) - ).deserialize(GetSearchesNoResultsResponse) + resp = self.get_searches_no_results_with_http_info( + index, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetSearchesNoResultsResponse, resp.raw_data) def get_status_with_http_info( self, @@ -4998,9 +4948,8 @@ def get_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetStatusResponse' result object. """ - return (self.get_status_with_http_info(index, request_options)).deserialize( - GetStatusResponse - ) + resp = self.get_status_with_http_info(index, request_options) + return resp.deserialize(GetStatusResponse, resp.raw_data) def get_top_countries_with_http_info( self, @@ -5135,11 +5084,10 @@ def get_top_countries( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopCountriesResponse' result object. """ - return ( - self.get_top_countries_with_http_info( - index, start_date, end_date, limit, offset, tags, request_options - ) - ).deserialize(GetTopCountriesResponse) + resp = self.get_top_countries_with_http_info( + index, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetTopCountriesResponse, resp.raw_data) def get_top_filter_attributes_with_http_info( self, @@ -5286,18 +5234,10 @@ def get_top_filter_attributes( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopFilterAttributesResponse' result object. """ - return ( - self.get_top_filter_attributes_with_http_info( - index, - search, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopFilterAttributesResponse) + resp = self.get_top_filter_attributes_with_http_info( + index, search, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetTopFilterAttributesResponse, resp.raw_data) def get_top_filter_for_attribute_with_http_info( self, @@ -5457,19 +5397,18 @@ def get_top_filter_for_attribute( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopFilterForAttributeResponse' result object. """ - return ( - self.get_top_filter_for_attribute_with_http_info( - attribute, - index, - search, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopFilterForAttributeResponse) + resp = self.get_top_filter_for_attribute_with_http_info( + attribute, + index, + search, + start_date, + end_date, + limit, + offset, + tags, + request_options, + ) + return resp.deserialize(GetTopFilterForAttributeResponse, resp.raw_data) def get_top_filters_no_results_with_http_info( self, @@ -5616,18 +5555,10 @@ def get_top_filters_no_results( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopFiltersNoResultsResponse' result object. """ - return ( - self.get_top_filters_no_results_with_http_info( - index, - search, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopFiltersNoResultsResponse) + resp = self.get_top_filters_no_results_with_http_info( + index, search, start_date, end_date, limit, offset, tags, request_options + ) + return resp.deserialize(GetTopFiltersNoResultsResponse, resp.raw_data) def get_top_hits_with_http_info( self, @@ -5810,20 +5741,19 @@ def get_top_hits( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopHitsResponse' result object. """ - return ( - self.get_top_hits_with_http_info( - index, - search, - click_analytics, - revenue_analytics, - start_date, - end_date, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopHitsResponse) + resp = self.get_top_hits_with_http_info( + index, + search, + click_analytics, + revenue_analytics, + start_date, + end_date, + limit, + offset, + tags, + request_options, + ) + return resp.deserialize(GetTopHitsResponse, resp.raw_data) def get_top_searches_with_http_info( self, @@ -6030,21 +5960,20 @@ def get_top_searches( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopSearchesResponse' result object. """ - return ( - self.get_top_searches_with_http_info( - index, - click_analytics, - revenue_analytics, - start_date, - end_date, - order_by, - direction, - limit, - offset, - tags, - request_options, - ) - ).deserialize(GetTopSearchesResponse) + resp = self.get_top_searches_with_http_info( + index, + click_analytics, + revenue_analytics, + start_date, + end_date, + order_by, + direction, + limit, + offset, + tags, + request_options, + ) + return resp.deserialize(GetTopSearchesResponse, resp.raw_data) def get_users_count_with_http_info( self, @@ -6153,8 +6082,7 @@ def get_users_count( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetUsersCountResponse' result object. """ - return ( - self.get_users_count_with_http_info( - index, start_date, end_date, tags, request_options - ) - ).deserialize(GetUsersCountResponse) + resp = self.get_users_count_with_http_info( + index, start_date, end_date, tags, request_options + ) + return resp.deserialize(GetUsersCountResponse, resp.raw_data) diff --git a/algoliasearch/http/api_response.py b/algoliasearch/http/api_response.py index 213ebb3c8..8c5e0748e 100644 --- a/algoliasearch/http/api_response.py +++ b/algoliasearch/http/api_response.py @@ -10,14 +10,14 @@ T = TypeVar("T") +PRIMITIVE_TYPES = (float, bool, bytes, str, int) + class ApiResponse(Generic[T]): """ API response object """ - PRIMITIVE_TYPES = (float, bool, bytes, str, int) - def __init__( self, verb: Verb, @@ -29,8 +29,8 @@ def __init__( is_timed_out_error: bool = False, path: str = "", query_parameters: Optional[Dict[str, Any]] = None, - raw_data: str = None, - status_code: int = None, + raw_data: Optional[str] = None, + status_code: Optional[int] = None, timeouts: Optional[Dict[str, int]] = None, url: str = "", ) -> None: @@ -51,7 +51,8 @@ def __init__( def to_json(self) -> str: return str(self.__dict__) - def deserialize(self, klass: any = None, data: any = None) -> T: + @staticmethod + def deserialize(klass: Any = None, data: Any = None) -> Any: """Deserializes dict, list, str into an object. :param data: dict, list or str. @@ -59,26 +60,28 @@ def deserialize(self, klass: any = None, data: any = None) -> T: :return: object. """ - if data is None: - data = self.raw_data if data is None: return None if hasattr(klass, "__origin__") and klass.__origin__ is list: sub_kls = klass.__args__[0] arr = json.loads(data) - return [self.deserialize(sub_kls, sub_data) for sub_data in arr] + return [ApiResponse.deserialize(sub_kls, sub_data) for sub_data in arr] if isinstance(klass, str): if klass.startswith("List["): - sub_kls = match(r"List\[(.*)]", klass).group(1) - return [self.deserialize(sub_kls, sub_data) for sub_data in data] + sub_kls = match(r"List\[(.*)]", klass) + if sub_kls is not None: + sub_kls = sub_kls.group(1) + return [ApiResponse.deserialize(sub_kls, sub_data) for sub_data in data] if klass.startswith("Dict["): - sub_kls = match(r"Dict\[([^,]*), (.*)]", klass).group(2) - return {k: self.deserialize(sub_kls, v) for k, v in data.items()} + sub_kls = match(r"Dict\[([^,]*), (.*)]", klass) + if sub_kls is not None: + sub_kls = sub_kls.group(2) + return {k: ApiResponse.deserialize(sub_kls, v) for k, v in data.items()} - if klass in self.PRIMITIVE_TYPES: + if klass in PRIMITIVE_TYPES: try: return klass(data) except UnicodeEncodeError: diff --git a/algoliasearch/http/helpers.py b/algoliasearch/http/helpers.py index 48459cfa0..196694d1c 100644 --- a/algoliasearch/http/helpers.py +++ b/algoliasearch/http/helpers.py @@ -2,37 +2,37 @@ import asyncio import time -from typing import Callable, TypeVar +from typing import Awaitable, Callable, Optional, TypeVar T = TypeVar("T") class Timeout: - def __call__(self) -> int: - return 0 + def __call__(self, retry_count: int = 0) -> int: + return retry_count def __init__(self) -> None: pass class RetryTimeout(Timeout): - def __call__(self, retry_count: int) -> int: + def __call__(self, retry_count: int = 0) -> int: return int(min(retry_count * 0.2, 5)) async def create_iterable( - func: Callable[[T], T], + func: Callable[[Optional[T]], Awaitable[T]], validate: Callable[[T], bool], aggregator: Callable[[T], None], timeout: Timeout = Timeout(), - error_validate: Callable[[T], bool] = None, - error_message: Callable[[T], str] = None, + error_validate: Optional[Callable[[T], bool]] = None, + error_message: Optional[Callable[[T], str]] = None, ) -> T: """ Helper: Iterates until the given `func` until `timeout` or `validate`. """ - async def retry(prev: T = None) -> T: + async def retry(prev: Optional[T] = None) -> T: resp = await func(prev) if aggregator: @@ -53,18 +53,18 @@ async def retry(prev: T = None) -> T: def create_iterable_sync( - func: Callable[[T], T], + func: Callable[[Optional[T]], T], validate: Callable[[T], bool], aggregator: Callable[[T], None], timeout: Timeout = Timeout(), - error_validate: Callable[[T], bool] = None, - error_message: Callable[[T], str] = None, + error_validate: Optional[Callable[[T], bool]] = None, + error_message: Optional[Callable[[T], str]] = None, ) -> T: """ Helper: Iterates until the given `func` until `timeout` or `validate`. """ - def retry(prev: T = None) -> T: + def retry(prev: Optional[T] = None) -> T: resp = func(prev) if aggregator: diff --git a/algoliasearch/http/request_options.py b/algoliasearch/http/request_options.py index cd88c25bd..41104a092 100644 --- a/algoliasearch/http/request_options.py +++ b/algoliasearch/http/request_options.py @@ -44,7 +44,7 @@ def to_dict(self) -> Dict[str, Any]: def to_json(self) -> str: return str(self.__dict__) - def from_dict(self, data: Optional[Dict[str, Dict[str, Any]]]) -> Self: + def from_dict(self, data: Dict[str, Dict[str, Any]]) -> Self: return RequestOptions( config=self._config, headers=data.get("headers", {}), @@ -57,8 +57,8 @@ def merge( self, query_parameters: List[Tuple[str, str]] = [], headers: Dict[str, Optional[str]] = {}, - timeouts: Dict[str, int] = {}, - data: Optional[Union[dict, list]] = None, + _: Dict[str, int] = {}, + data: Optional[str] = None, user_request_options: Optional[Union[Self, Dict[str, Any]]] = None, ) -> Self: """ @@ -85,9 +85,6 @@ def merge( _user_request_options = user_request_options for key, value in _user_request_options.items(): - if key == "data" and isinstance(value, dict): - request_options.data = value - continue request_options[key].update(value) return self.from_dict(request_options) diff --git a/algoliasearch/http/serializer.py b/algoliasearch/http/serializer.py index 9b57f254b..52bba424c 100644 --- a/algoliasearch/http/serializer.py +++ b/algoliasearch/http/serializer.py @@ -1,5 +1,5 @@ from json import dumps -from typing import Any, Dict +from typing import Any, Dict, Optional from urllib.parse import urlencode PRIMITIVE_TYPES = (float, bool, bytes, str, int) @@ -27,7 +27,7 @@ def encoded(self) -> str: dict(sorted(self.query_parameters.items(), key=lambda val: val[0])) ).replace("+", "%20") - def __init__(self, query_parameters: Dict[str, Any]) -> None: + def __init__(self, query_parameters: Optional[Dict[str, Any]]) -> None: self.query_parameters = {} if query_parameters is None: return @@ -39,7 +39,7 @@ def __init__(self, query_parameters: Dict[str, Any]) -> None: self.query_parameters[key] = self.parse(value) -def bodySerializer(obj: Any) -> dict: +def bodySerializer(obj: Any) -> Any: """Builds a JSON POST object. If obj is None, return None. diff --git a/algoliasearch/http/transporter.py b/algoliasearch/http/transporter.py index 638332513..a52e31276 100644 --- a/algoliasearch/http/transporter.py +++ b/algoliasearch/http/transporter.py @@ -25,6 +25,13 @@ def __init__(self, config: BaseConfig) -> None: self._retry_strategy = RetryStrategy() self._hosts = [] + async def close(self) -> None: + if self._session is not None: + _session = self._session + self._session = None + + await _session.close() + async def request( self, verb: Verb, diff --git a/algoliasearch/ingestion/client.py b/algoliasearch/ingestion/client.py index f1b640848..5ccd174c8 100644 --- a/algoliasearch/ingestion/client.py +++ b/algoliasearch/ingestion/client.py @@ -167,9 +167,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: IngestionConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: IngestionConfig, transporter: Optional[Transporter] = None + ) -> IngestionClient: """Allows creating a client with a customized `IngestionConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -194,7 +195,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -265,11 +266,10 @@ async def create_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AuthenticationCreateResponse' result object. """ - return ( - await self.create_authentication_with_http_info( - authentication_create, request_options - ) - ).deserialize(AuthenticationCreateResponse) + resp = await self.create_authentication_with_http_info( + authentication_create, request_options + ) + return resp.deserialize(AuthenticationCreateResponse, resp.raw_data) async def create_destination_with_http_info( self, @@ -327,11 +327,10 @@ async def create_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DestinationCreateResponse' result object. """ - return ( - await self.create_destination_with_http_info( - destination_create, request_options - ) - ).deserialize(DestinationCreateResponse) + resp = await self.create_destination_with_http_info( + destination_create, request_options + ) + return resp.deserialize(DestinationCreateResponse, resp.raw_data) async def create_source_with_http_info( self, @@ -389,9 +388,8 @@ async def create_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceCreateResponse' result object. """ - return ( - await self.create_source_with_http_info(source_create, request_options) - ).deserialize(SourceCreateResponse) + resp = await self.create_source_with_http_info(source_create, request_options) + return resp.deserialize(SourceCreateResponse, resp.raw_data) async def create_task_with_http_info( self, @@ -445,9 +443,8 @@ async def create_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskCreateResponse' result object. """ - return ( - await self.create_task_with_http_info(task_create, request_options) - ).deserialize(TaskCreateResponse) + resp = await self.create_task_with_http_info(task_create, request_options) + return resp.deserialize(TaskCreateResponse, resp.raw_data) async def create_task_v1_with_http_info( self, @@ -501,9 +498,8 @@ async def create_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskCreateResponse' result object. """ - return ( - await self.create_task_v1_with_http_info(task_create, request_options) - ).deserialize(TaskCreateResponse) + resp = await self.create_task_v1_with_http_info(task_create, request_options) + return resp.deserialize(TaskCreateResponse, resp.raw_data) async def create_transformation_with_http_info( self, @@ -559,11 +555,10 @@ async def create_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationCreateResponse' result object. """ - return ( - await self.create_transformation_with_http_info( - transformation_create, request_options - ) - ).deserialize(TransformationCreateResponse) + resp = await self.create_transformation_with_http_info( + transformation_create, request_options + ) + return resp.deserialize(TransformationCreateResponse, resp.raw_data) async def custom_delete_with_http_info( self, @@ -637,9 +632,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -711,9 +707,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -802,11 +797,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -895,11 +889,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_authentication_with_http_info( self, @@ -960,11 +953,10 @@ async def delete_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - await self.delete_authentication_with_http_info( - authentication_id, request_options - ) - ).deserialize(DeleteResponse) + resp = await self.delete_authentication_with_http_info( + authentication_id, request_options + ) + return resp.deserialize(DeleteResponse, resp.raw_data) async def delete_destination_with_http_info( self, @@ -1023,11 +1015,10 @@ async def delete_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - await self.delete_destination_with_http_info( - destination_id, request_options - ) - ).deserialize(DeleteResponse) + resp = await self.delete_destination_with_http_info( + destination_id, request_options + ) + return resp.deserialize(DeleteResponse, resp.raw_data) async def delete_source_with_http_info( self, @@ -1086,9 +1077,8 @@ async def delete_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - await self.delete_source_with_http_info(source_id, request_options) - ).deserialize(DeleteResponse) + resp = await self.delete_source_with_http_info(source_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) async def delete_task_with_http_info( self, @@ -1137,9 +1127,8 @@ async def delete_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - await self.delete_task_with_http_info(task_id, request_options) - ).deserialize(DeleteResponse) + resp = await self.delete_task_with_http_info(task_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) async def delete_task_v1_with_http_info( self, @@ -1188,9 +1177,8 @@ async def delete_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - await self.delete_task_v1_with_http_info(task_id, request_options) - ).deserialize(DeleteResponse) + resp = await self.delete_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) async def delete_transformation_with_http_info( self, @@ -1241,11 +1229,10 @@ async def delete_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - await self.delete_transformation_with_http_info( - transformation_id, request_options - ) - ).deserialize(DeleteResponse) + resp = await self.delete_transformation_with_http_info( + transformation_id, request_options + ) + return resp.deserialize(DeleteResponse, resp.raw_data) async def disable_task_with_http_info( self, @@ -1304,9 +1291,8 @@ async def disable_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - await self.disable_task_with_http_info(task_id, request_options) - ).deserialize(TaskUpdateResponse) + resp = await self.disable_task_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) async def disable_task_v1_with_http_info( self, @@ -1369,9 +1355,8 @@ async def disable_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - await self.disable_task_v1_with_http_info(task_id, request_options) - ).deserialize(TaskUpdateResponse) + resp = await self.disable_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) async def enable_task_with_http_info( self, @@ -1430,9 +1415,8 @@ async def enable_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - await self.enable_task_with_http_info(task_id, request_options) - ).deserialize(TaskUpdateResponse) + resp = await self.enable_task_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) async def enable_task_v1_with_http_info( self, @@ -1491,9 +1475,8 @@ async def enable_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - await self.enable_task_v1_with_http_info(task_id, request_options) - ).deserialize(TaskUpdateResponse) + resp = await self.enable_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) async def generate_transformation_code_with_http_info( self, @@ -1551,11 +1534,10 @@ async def generate_transformation_code( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GenerateTransformationCodeResponse' result object. """ - return ( - await self.generate_transformation_code_with_http_info( - generate_transformation_code_payload, request_options - ) - ).deserialize(GenerateTransformationCodeResponse) + resp = await self.generate_transformation_code_with_http_info( + generate_transformation_code_payload, request_options + ) + return resp.deserialize(GenerateTransformationCodeResponse, resp.raw_data) async def get_authentication_with_http_info( self, @@ -1616,11 +1598,10 @@ async def get_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Authentication' result object. """ - return ( - await self.get_authentication_with_http_info( - authentication_id, request_options - ) - ).deserialize(Authentication) + resp = await self.get_authentication_with_http_info( + authentication_id, request_options + ) + return resp.deserialize(Authentication, resp.raw_data) async def get_destination_with_http_info( self, @@ -1679,9 +1660,10 @@ async def get_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Destination' result object. """ - return ( - await self.get_destination_with_http_info(destination_id, request_options) - ).deserialize(Destination) + resp = await self.get_destination_with_http_info( + destination_id, request_options + ) + return resp.deserialize(Destination, resp.raw_data) async def get_event_with_http_info( self, @@ -1753,9 +1735,8 @@ async def get_event( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Event' result object. """ - return ( - await self.get_event_with_http_info(run_id, event_id, request_options) - ).deserialize(Event) + resp = await self.get_event_with_http_info(run_id, event_id, request_options) + return resp.deserialize(Event, resp.raw_data) async def get_run_with_http_info( self, @@ -1810,9 +1791,8 @@ async def get_run( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Run' result object. """ - return (await self.get_run_with_http_info(run_id, request_options)).deserialize( - Run - ) + resp = await self.get_run_with_http_info(run_id, request_options) + return resp.deserialize(Run, resp.raw_data) async def get_source_with_http_info( self, @@ -1871,9 +1851,8 @@ async def get_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Source' result object. """ - return ( - await self.get_source_with_http_info(source_id, request_options) - ).deserialize(Source) + resp = await self.get_source_with_http_info(source_id, request_options) + return resp.deserialize(Source, resp.raw_data) async def get_task_with_http_info( self, @@ -1928,9 +1907,8 @@ async def get_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Task' result object. """ - return ( - await self.get_task_with_http_info(task_id, request_options) - ).deserialize(Task) + resp = await self.get_task_with_http_info(task_id, request_options) + return resp.deserialize(Task, resp.raw_data) async def get_task_v1_with_http_info( self, @@ -1987,9 +1965,8 @@ async def get_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskV1' result object. """ - return ( - await self.get_task_v1_with_http_info(task_id, request_options) - ).deserialize(TaskV1) + resp = await self.get_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(TaskV1, resp.raw_data) async def get_transformation_with_http_info( self, @@ -2048,11 +2025,10 @@ async def get_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Transformation' result object. """ - return ( - await self.get_transformation_with_http_info( - transformation_id, request_options - ) - ).deserialize(Transformation) + resp = await self.get_transformation_with_http_info( + transformation_id, request_options + ) + return resp.deserialize(Transformation, resp.raw_data) async def list_authentications_with_http_info( self, @@ -2190,11 +2166,10 @@ async def list_authentications( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListAuthenticationsResponse' result object. """ - return ( - await self.list_authentications_with_http_info( - items_per_page, page, type, platform, sort, order, request_options - ) - ).deserialize(ListAuthenticationsResponse) + resp = await self.list_authentications_with_http_info( + items_per_page, page, type, platform, sort, order, request_options + ) + return resp.deserialize(ListAuthenticationsResponse, resp.raw_data) async def list_destinations_with_http_info( self, @@ -2322,17 +2297,10 @@ async def list_destinations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListDestinationsResponse' result object. """ - return ( - await self.list_destinations_with_http_info( - items_per_page, - page, - type, - authentication_id, - sort, - order, - request_options, - ) - ).deserialize(ListDestinationsResponse) + resp = await self.list_destinations_with_http_info( + items_per_page, page, type, authentication_id, sort, order, request_options + ) + return resp.deserialize(ListDestinationsResponse, resp.raw_data) async def list_events_with_http_info( self, @@ -2515,20 +2483,19 @@ async def list_events( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListEventsResponse' result object. """ - return ( - await self.list_events_with_http_info( - run_id, - items_per_page, - page, - status, - type, - sort, - order, - start_date, - end_date, - request_options, - ) - ).deserialize(ListEventsResponse) + resp = await self.list_events_with_http_info( + run_id, + items_per_page, + page, + status, + type, + sort, + order, + start_date, + end_date, + request_options, + ) + return resp.deserialize(ListEventsResponse, resp.raw_data) async def list_runs_with_http_info( self, @@ -2708,20 +2675,19 @@ async def list_runs( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunListResponse' result object. """ - return ( - await self.list_runs_with_http_info( - items_per_page, - page, - status, - type, - task_id, - sort, - order, - start_date, - end_date, - request_options, - ) - ).deserialize(RunListResponse) + resp = await self.list_runs_with_http_info( + items_per_page, + page, + status, + type, + task_id, + sort, + order, + start_date, + end_date, + request_options, + ) + return resp.deserialize(RunListResponse, resp.raw_data) async def list_sources_with_http_info( self, @@ -2855,17 +2821,10 @@ async def list_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListSourcesResponse' result object. """ - return ( - await self.list_sources_with_http_info( - items_per_page, - page, - type, - authentication_id, - sort, - order, - request_options, - ) - ).deserialize(ListSourcesResponse) + resp = await self.list_sources_with_http_info( + items_per_page, page, type, authentication_id, sort, order, request_options + ) + return resp.deserialize(ListSourcesResponse, resp.raw_data) async def list_tasks_with_http_info( self, @@ -3041,20 +3000,19 @@ async def list_tasks( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListTasksResponse' result object. """ - return ( - await self.list_tasks_with_http_info( - items_per_page, - page, - action, - enabled, - source_id, - destination_id, - trigger_type, - sort, - order, - request_options, - ) - ).deserialize(ListTasksResponse) + resp = await self.list_tasks_with_http_info( + items_per_page, + page, + action, + enabled, + source_id, + destination_id, + trigger_type, + sort, + order, + request_options, + ) + return resp.deserialize(ListTasksResponse, resp.raw_data) async def list_tasks_v1_with_http_info( self, @@ -3230,20 +3188,19 @@ async def list_tasks_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListTasksResponseV1' result object. """ - return ( - await self.list_tasks_v1_with_http_info( - items_per_page, - page, - action, - enabled, - source_id, - destination_id, - trigger_type, - sort, - order, - request_options, - ) - ).deserialize(ListTasksResponseV1) + resp = await self.list_tasks_v1_with_http_info( + items_per_page, + page, + action, + enabled, + source_id, + destination_id, + trigger_type, + sort, + order, + request_options, + ) + return resp.deserialize(ListTasksResponseV1, resp.raw_data) async def list_transformation_models_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -3283,9 +3240,8 @@ async def list_transformation_models( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationModels' result object. """ - return ( - await self.list_transformation_models_with_http_info(request_options) - ).deserialize(TransformationModels) + resp = await self.list_transformation_models_with_http_info(request_options) + return resp.deserialize(TransformationModels, resp.raw_data) async def list_transformations_with_http_info( self, @@ -3385,11 +3341,10 @@ async def list_transformations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListTransformationsResponse' result object. """ - return ( - await self.list_transformations_with_http_info( - items_per_page, page, sort, order, request_options - ) - ).deserialize(ListTransformationsResponse) + resp = await self.list_transformations_with_http_info( + items_per_page, page, sort, order, request_options + ) + return resp.deserialize(ListTransformationsResponse, resp.raw_data) async def push_task_with_http_info( self, @@ -3474,11 +3429,10 @@ async def push_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunResponse' result object. """ - return ( - await self.push_task_with_http_info( - task_id, push_task_payload, request_options - ) - ).deserialize(RunResponse) + resp = await self.push_task_with_http_info( + task_id, push_task_payload, request_options + ) + return resp.deserialize(RunResponse, resp.raw_data) async def run_source_with_http_info( self, @@ -3548,11 +3502,10 @@ async def run_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunSourceResponse' result object. """ - return ( - await self.run_source_with_http_info( - source_id, run_source_payload, request_options - ) - ).deserialize(RunSourceResponse) + resp = await self.run_source_with_http_info( + source_id, run_source_payload, request_options + ) + return resp.deserialize(RunSourceResponse, resp.raw_data) async def run_task_with_http_info( self, @@ -3609,9 +3562,8 @@ async def run_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunResponse' result object. """ - return ( - await self.run_task_with_http_info(task_id, request_options) - ).deserialize(RunResponse) + resp = await self.run_task_with_http_info(task_id, request_options) + return resp.deserialize(RunResponse, resp.raw_data) async def run_task_v1_with_http_info( self, @@ -3670,9 +3622,8 @@ async def run_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunResponse' result object. """ - return ( - await self.run_task_v1_with_http_info(task_id, request_options) - ).deserialize(RunResponse) + resp = await self.run_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(RunResponse, resp.raw_data) async def search_authentications_with_http_info( self, @@ -3730,11 +3681,10 @@ async def search_authentications( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Authentication]' result object. """ - return ( - await self.search_authentications_with_http_info( - authentication_search, request_options - ) - ).deserialize(List[Authentication]) + resp = await self.search_authentications_with_http_info( + authentication_search, request_options + ) + return resp.deserialize(List[Authentication], resp.raw_data) async def search_destinations_with_http_info( self, @@ -3792,11 +3742,10 @@ async def search_destinations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Destination]' result object. """ - return ( - await self.search_destinations_with_http_info( - destination_search, request_options - ) - ).deserialize(List[Destination]) + resp = await self.search_destinations_with_http_info( + destination_search, request_options + ) + return resp.deserialize(List[Destination], resp.raw_data) async def search_sources_with_http_info( self, @@ -3854,9 +3803,8 @@ async def search_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Source]' result object. """ - return ( - await self.search_sources_with_http_info(source_search, request_options) - ).deserialize(List[Source]) + resp = await self.search_sources_with_http_info(source_search, request_options) + return resp.deserialize(List[Source], resp.raw_data) async def search_tasks_with_http_info( self, @@ -3914,9 +3862,8 @@ async def search_tasks( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Task]' result object. """ - return ( - await self.search_tasks_with_http_info(task_search, request_options) - ).deserialize(List[Task]) + resp = await self.search_tasks_with_http_info(task_search, request_options) + return resp.deserialize(List[Task], resp.raw_data) async def search_tasks_v1_with_http_info( self, @@ -3974,9 +3921,8 @@ async def search_tasks_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[TaskV1]' result object. """ - return ( - await self.search_tasks_v1_with_http_info(task_search, request_options) - ).deserialize(List[TaskV1]) + resp = await self.search_tasks_v1_with_http_info(task_search, request_options) + return resp.deserialize(List[TaskV1], resp.raw_data) async def search_transformations_with_http_info( self, @@ -4034,11 +3980,10 @@ async def search_transformations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Transformation]' result object. """ - return ( - await self.search_transformations_with_http_info( - transformation_search, request_options - ) - ).deserialize(List[Transformation]) + resp = await self.search_transformations_with_http_info( + transformation_search, request_options + ) + return resp.deserialize(List[Transformation], resp.raw_data) async def trigger_docker_source_discover_with_http_info( self, @@ -4097,11 +4042,10 @@ async def trigger_docker_source_discover( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceWatchResponse' result object. """ - return ( - await self.trigger_docker_source_discover_with_http_info( - source_id, request_options - ) - ).deserialize(SourceWatchResponse) + resp = await self.trigger_docker_source_discover_with_http_info( + source_id, request_options + ) + return resp.deserialize(SourceWatchResponse, resp.raw_data) async def try_transformation_with_http_info( self, @@ -4159,11 +4103,10 @@ async def try_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationTryResponse' result object. """ - return ( - await self.try_transformation_with_http_info( - transformation_try, request_options - ) - ).deserialize(TransformationTryResponse) + resp = await self.try_transformation_with_http_info( + transformation_try, request_options + ) + return resp.deserialize(TransformationTryResponse, resp.raw_data) async def try_transformation_before_update_with_http_info( self, @@ -4238,11 +4181,10 @@ async def try_transformation_before_update( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationTryResponse' result object. """ - return ( - await self.try_transformation_before_update_with_http_info( - transformation_id, transformation_try, request_options - ) - ).deserialize(TransformationTryResponse) + resp = await self.try_transformation_before_update_with_http_info( + transformation_id, transformation_try, request_options + ) + return resp.deserialize(TransformationTryResponse, resp.raw_data) async def update_authentication_with_http_info( self, @@ -4319,11 +4261,10 @@ async def update_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AuthenticationUpdateResponse' result object. """ - return ( - await self.update_authentication_with_http_info( - authentication_id, authentication_update, request_options - ) - ).deserialize(AuthenticationUpdateResponse) + resp = await self.update_authentication_with_http_info( + authentication_id, authentication_update, request_options + ) + return resp.deserialize(AuthenticationUpdateResponse, resp.raw_data) async def update_destination_with_http_info( self, @@ -4398,11 +4339,10 @@ async def update_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DestinationUpdateResponse' result object. """ - return ( - await self.update_destination_with_http_info( - destination_id, destination_update, request_options - ) - ).deserialize(DestinationUpdateResponse) + resp = await self.update_destination_with_http_info( + destination_id, destination_update, request_options + ) + return resp.deserialize(DestinationUpdateResponse, resp.raw_data) async def update_source_with_http_info( self, @@ -4477,11 +4417,10 @@ async def update_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceUpdateResponse' result object. """ - return ( - await self.update_source_with_http_info( - source_id, source_update, request_options - ) - ).deserialize(SourceUpdateResponse) + resp = await self.update_source_with_http_info( + source_id, source_update, request_options + ) + return resp.deserialize(SourceUpdateResponse, resp.raw_data) async def update_task_with_http_info( self, @@ -4546,9 +4485,10 @@ async def update_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - await self.update_task_with_http_info(task_id, task_update, request_options) - ).deserialize(TaskUpdateResponse) + resp = await self.update_task_with_http_info( + task_id, task_update, request_options + ) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) async def update_task_v1_with_http_info( self, @@ -4613,11 +4553,10 @@ async def update_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - await self.update_task_v1_with_http_info( - task_id, task_update, request_options - ) - ).deserialize(TaskUpdateResponse) + resp = await self.update_task_v1_with_http_info( + task_id, task_update, request_options + ) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) async def update_transformation_with_http_info( self, @@ -4684,11 +4623,10 @@ async def update_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationUpdateResponse' result object. """ - return ( - await self.update_transformation_with_http_info( - transformation_id, transformation_create, request_options - ) - ).deserialize(TransformationUpdateResponse) + resp = await self.update_transformation_with_http_info( + transformation_id, transformation_create, request_options + ) + return resp.deserialize(TransformationUpdateResponse, resp.raw_data) async def validate_source_with_http_info( self, @@ -4741,9 +4679,8 @@ async def validate_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceWatchResponse' result object. """ - return ( - await self.validate_source_with_http_info(source_create, request_options) - ).deserialize(SourceWatchResponse) + resp = await self.validate_source_with_http_info(source_create, request_options) + return resp.deserialize(SourceWatchResponse, resp.raw_data) async def validate_source_before_update_with_http_info( self, @@ -4818,11 +4755,10 @@ async def validate_source_before_update( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceWatchResponse' result object. """ - return ( - await self.validate_source_before_update_with_http_info( - source_id, source_update, request_options - ) - ).deserialize(SourceWatchResponse) + resp = await self.validate_source_before_update_with_http_info( + source_id, source_update, request_options + ) + return resp.deserialize(SourceWatchResponse, resp.raw_data) class IngestionClientSync: @@ -4867,9 +4803,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: IngestionConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: IngestionConfig, transporter: Optional[TransporterSync] = None + ) -> IngestionClientSync: """Allows creating a client with a customized `IngestionConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -4964,11 +4901,10 @@ def create_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AuthenticationCreateResponse' result object. """ - return ( - self.create_authentication_with_http_info( - authentication_create, request_options - ) - ).deserialize(AuthenticationCreateResponse) + resp = self.create_authentication_with_http_info( + authentication_create, request_options + ) + return resp.deserialize(AuthenticationCreateResponse, resp.raw_data) def create_destination_with_http_info( self, @@ -5026,9 +4962,10 @@ def create_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DestinationCreateResponse' result object. """ - return ( - self.create_destination_with_http_info(destination_create, request_options) - ).deserialize(DestinationCreateResponse) + resp = self.create_destination_with_http_info( + destination_create, request_options + ) + return resp.deserialize(DestinationCreateResponse, resp.raw_data) def create_source_with_http_info( self, @@ -5086,9 +5023,8 @@ def create_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceCreateResponse' result object. """ - return ( - self.create_source_with_http_info(source_create, request_options) - ).deserialize(SourceCreateResponse) + resp = self.create_source_with_http_info(source_create, request_options) + return resp.deserialize(SourceCreateResponse, resp.raw_data) def create_task_with_http_info( self, @@ -5142,9 +5078,8 @@ def create_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskCreateResponse' result object. """ - return ( - self.create_task_with_http_info(task_create, request_options) - ).deserialize(TaskCreateResponse) + resp = self.create_task_with_http_info(task_create, request_options) + return resp.deserialize(TaskCreateResponse, resp.raw_data) def create_task_v1_with_http_info( self, @@ -5198,9 +5133,8 @@ def create_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskCreateResponse' result object. """ - return ( - self.create_task_v1_with_http_info(task_create, request_options) - ).deserialize(TaskCreateResponse) + resp = self.create_task_v1_with_http_info(task_create, request_options) + return resp.deserialize(TaskCreateResponse, resp.raw_data) def create_transformation_with_http_info( self, @@ -5256,11 +5190,10 @@ def create_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationCreateResponse' result object. """ - return ( - self.create_transformation_with_http_info( - transformation_create, request_options - ) - ).deserialize(TransformationCreateResponse) + resp = self.create_transformation_with_http_info( + transformation_create, request_options + ) + return resp.deserialize(TransformationCreateResponse, resp.raw_data) def custom_delete_with_http_info( self, @@ -5334,9 +5267,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -5408,9 +5340,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -5499,9 +5430,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -5590,9 +5520,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_authentication_with_http_info( self, @@ -5653,11 +5582,10 @@ def delete_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - self.delete_authentication_with_http_info( - authentication_id, request_options - ) - ).deserialize(DeleteResponse) + resp = self.delete_authentication_with_http_info( + authentication_id, request_options + ) + return resp.deserialize(DeleteResponse, resp.raw_data) def delete_destination_with_http_info( self, @@ -5716,9 +5644,8 @@ def delete_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - self.delete_destination_with_http_info(destination_id, request_options) - ).deserialize(DeleteResponse) + resp = self.delete_destination_with_http_info(destination_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) def delete_source_with_http_info( self, @@ -5777,9 +5704,8 @@ def delete_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - self.delete_source_with_http_info(source_id, request_options) - ).deserialize(DeleteResponse) + resp = self.delete_source_with_http_info(source_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) def delete_task_with_http_info( self, @@ -5828,9 +5754,8 @@ def delete_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return (self.delete_task_with_http_info(task_id, request_options)).deserialize( - DeleteResponse - ) + resp = self.delete_task_with_http_info(task_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) def delete_task_v1_with_http_info( self, @@ -5879,9 +5804,8 @@ def delete_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - self.delete_task_v1_with_http_info(task_id, request_options) - ).deserialize(DeleteResponse) + resp = self.delete_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(DeleteResponse, resp.raw_data) def delete_transformation_with_http_info( self, @@ -5932,11 +5856,10 @@ def delete_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteResponse' result object. """ - return ( - self.delete_transformation_with_http_info( - transformation_id, request_options - ) - ).deserialize(DeleteResponse) + resp = self.delete_transformation_with_http_info( + transformation_id, request_options + ) + return resp.deserialize(DeleteResponse, resp.raw_data) def disable_task_with_http_info( self, @@ -5995,9 +5918,8 @@ def disable_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return (self.disable_task_with_http_info(task_id, request_options)).deserialize( - TaskUpdateResponse - ) + resp = self.disable_task_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) def disable_task_v1_with_http_info( self, @@ -6060,9 +5982,8 @@ def disable_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - self.disable_task_v1_with_http_info(task_id, request_options) - ).deserialize(TaskUpdateResponse) + resp = self.disable_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) def enable_task_with_http_info( self, @@ -6121,9 +6042,8 @@ def enable_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return (self.enable_task_with_http_info(task_id, request_options)).deserialize( - TaskUpdateResponse - ) + resp = self.enable_task_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) def enable_task_v1_with_http_info( self, @@ -6182,9 +6102,8 @@ def enable_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - self.enable_task_v1_with_http_info(task_id, request_options) - ).deserialize(TaskUpdateResponse) + resp = self.enable_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) def generate_transformation_code_with_http_info( self, @@ -6242,11 +6161,10 @@ def generate_transformation_code( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GenerateTransformationCodeResponse' result object. """ - return ( - self.generate_transformation_code_with_http_info( - generate_transformation_code_payload, request_options - ) - ).deserialize(GenerateTransformationCodeResponse) + resp = self.generate_transformation_code_with_http_info( + generate_transformation_code_payload, request_options + ) + return resp.deserialize(GenerateTransformationCodeResponse, resp.raw_data) def get_authentication_with_http_info( self, @@ -6307,9 +6225,10 @@ def get_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Authentication' result object. """ - return ( - self.get_authentication_with_http_info(authentication_id, request_options) - ).deserialize(Authentication) + resp = self.get_authentication_with_http_info( + authentication_id, request_options + ) + return resp.deserialize(Authentication, resp.raw_data) def get_destination_with_http_info( self, @@ -6368,9 +6287,8 @@ def get_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Destination' result object. """ - return ( - self.get_destination_with_http_info(destination_id, request_options) - ).deserialize(Destination) + resp = self.get_destination_with_http_info(destination_id, request_options) + return resp.deserialize(Destination, resp.raw_data) def get_event_with_http_info( self, @@ -6442,9 +6360,8 @@ def get_event( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Event' result object. """ - return ( - self.get_event_with_http_info(run_id, event_id, request_options) - ).deserialize(Event) + resp = self.get_event_with_http_info(run_id, event_id, request_options) + return resp.deserialize(Event, resp.raw_data) def get_run_with_http_info( self, @@ -6499,7 +6416,8 @@ def get_run( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Run' result object. """ - return (self.get_run_with_http_info(run_id, request_options)).deserialize(Run) + resp = self.get_run_with_http_info(run_id, request_options) + return resp.deserialize(Run, resp.raw_data) def get_source_with_http_info( self, @@ -6558,9 +6476,8 @@ def get_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Source' result object. """ - return (self.get_source_with_http_info(source_id, request_options)).deserialize( - Source - ) + resp = self.get_source_with_http_info(source_id, request_options) + return resp.deserialize(Source, resp.raw_data) def get_task_with_http_info( self, @@ -6615,9 +6532,8 @@ def get_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Task' result object. """ - return (self.get_task_with_http_info(task_id, request_options)).deserialize( - Task - ) + resp = self.get_task_with_http_info(task_id, request_options) + return resp.deserialize(Task, resp.raw_data) def get_task_v1_with_http_info( self, @@ -6674,9 +6590,8 @@ def get_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskV1' result object. """ - return (self.get_task_v1_with_http_info(task_id, request_options)).deserialize( - TaskV1 - ) + resp = self.get_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(TaskV1, resp.raw_data) def get_transformation_with_http_info( self, @@ -6735,9 +6650,10 @@ def get_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Transformation' result object. """ - return ( - self.get_transformation_with_http_info(transformation_id, request_options) - ).deserialize(Transformation) + resp = self.get_transformation_with_http_info( + transformation_id, request_options + ) + return resp.deserialize(Transformation, resp.raw_data) def list_authentications_with_http_info( self, @@ -6875,11 +6791,10 @@ def list_authentications( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListAuthenticationsResponse' result object. """ - return ( - self.list_authentications_with_http_info( - items_per_page, page, type, platform, sort, order, request_options - ) - ).deserialize(ListAuthenticationsResponse) + resp = self.list_authentications_with_http_info( + items_per_page, page, type, platform, sort, order, request_options + ) + return resp.deserialize(ListAuthenticationsResponse, resp.raw_data) def list_destinations_with_http_info( self, @@ -7007,17 +6922,10 @@ def list_destinations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListDestinationsResponse' result object. """ - return ( - self.list_destinations_with_http_info( - items_per_page, - page, - type, - authentication_id, - sort, - order, - request_options, - ) - ).deserialize(ListDestinationsResponse) + resp = self.list_destinations_with_http_info( + items_per_page, page, type, authentication_id, sort, order, request_options + ) + return resp.deserialize(ListDestinationsResponse, resp.raw_data) def list_events_with_http_info( self, @@ -7200,20 +7108,19 @@ def list_events( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListEventsResponse' result object. """ - return ( - self.list_events_with_http_info( - run_id, - items_per_page, - page, - status, - type, - sort, - order, - start_date, - end_date, - request_options, - ) - ).deserialize(ListEventsResponse) + resp = self.list_events_with_http_info( + run_id, + items_per_page, + page, + status, + type, + sort, + order, + start_date, + end_date, + request_options, + ) + return resp.deserialize(ListEventsResponse, resp.raw_data) def list_runs_with_http_info( self, @@ -7393,20 +7300,19 @@ def list_runs( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunListResponse' result object. """ - return ( - self.list_runs_with_http_info( - items_per_page, - page, - status, - type, - task_id, - sort, - order, - start_date, - end_date, - request_options, - ) - ).deserialize(RunListResponse) + resp = self.list_runs_with_http_info( + items_per_page, + page, + status, + type, + task_id, + sort, + order, + start_date, + end_date, + request_options, + ) + return resp.deserialize(RunListResponse, resp.raw_data) def list_sources_with_http_info( self, @@ -7540,17 +7446,10 @@ def list_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListSourcesResponse' result object. """ - return ( - self.list_sources_with_http_info( - items_per_page, - page, - type, - authentication_id, - sort, - order, - request_options, - ) - ).deserialize(ListSourcesResponse) + resp = self.list_sources_with_http_info( + items_per_page, page, type, authentication_id, sort, order, request_options + ) + return resp.deserialize(ListSourcesResponse, resp.raw_data) def list_tasks_with_http_info( self, @@ -7726,20 +7625,19 @@ def list_tasks( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListTasksResponse' result object. """ - return ( - self.list_tasks_with_http_info( - items_per_page, - page, - action, - enabled, - source_id, - destination_id, - trigger_type, - sort, - order, - request_options, - ) - ).deserialize(ListTasksResponse) + resp = self.list_tasks_with_http_info( + items_per_page, + page, + action, + enabled, + source_id, + destination_id, + trigger_type, + sort, + order, + request_options, + ) + return resp.deserialize(ListTasksResponse, resp.raw_data) def list_tasks_v1_with_http_info( self, @@ -7915,20 +7813,19 @@ def list_tasks_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListTasksResponseV1' result object. """ - return ( - self.list_tasks_v1_with_http_info( - items_per_page, - page, - action, - enabled, - source_id, - destination_id, - trigger_type, - sort, - order, - request_options, - ) - ).deserialize(ListTasksResponseV1) + resp = self.list_tasks_v1_with_http_info( + items_per_page, + page, + action, + enabled, + source_id, + destination_id, + trigger_type, + sort, + order, + request_options, + ) + return resp.deserialize(ListTasksResponseV1, resp.raw_data) def list_transformation_models_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -7968,9 +7865,8 @@ def list_transformation_models( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationModels' result object. """ - return ( - self.list_transformation_models_with_http_info(request_options) - ).deserialize(TransformationModels) + resp = self.list_transformation_models_with_http_info(request_options) + return resp.deserialize(TransformationModels, resp.raw_data) def list_transformations_with_http_info( self, @@ -8070,11 +7966,10 @@ def list_transformations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListTransformationsResponse' result object. """ - return ( - self.list_transformations_with_http_info( - items_per_page, page, sort, order, request_options - ) - ).deserialize(ListTransformationsResponse) + resp = self.list_transformations_with_http_info( + items_per_page, page, sort, order, request_options + ) + return resp.deserialize(ListTransformationsResponse, resp.raw_data) def push_task_with_http_info( self, @@ -8159,9 +8054,10 @@ def push_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunResponse' result object. """ - return ( - self.push_task_with_http_info(task_id, push_task_payload, request_options) - ).deserialize(RunResponse) + resp = self.push_task_with_http_info( + task_id, push_task_payload, request_options + ) + return resp.deserialize(RunResponse, resp.raw_data) def run_source_with_http_info( self, @@ -8231,11 +8127,10 @@ def run_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunSourceResponse' result object. """ - return ( - self.run_source_with_http_info( - source_id, run_source_payload, request_options - ) - ).deserialize(RunSourceResponse) + resp = self.run_source_with_http_info( + source_id, run_source_payload, request_options + ) + return resp.deserialize(RunSourceResponse, resp.raw_data) def run_task_with_http_info( self, @@ -8292,9 +8187,8 @@ def run_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunResponse' result object. """ - return (self.run_task_with_http_info(task_id, request_options)).deserialize( - RunResponse - ) + resp = self.run_task_with_http_info(task_id, request_options) + return resp.deserialize(RunResponse, resp.raw_data) def run_task_v1_with_http_info( self, @@ -8353,9 +8247,8 @@ def run_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RunResponse' result object. """ - return (self.run_task_v1_with_http_info(task_id, request_options)).deserialize( - RunResponse - ) + resp = self.run_task_v1_with_http_info(task_id, request_options) + return resp.deserialize(RunResponse, resp.raw_data) def search_authentications_with_http_info( self, @@ -8413,11 +8306,10 @@ def search_authentications( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Authentication]' result object. """ - return ( - self.search_authentications_with_http_info( - authentication_search, request_options - ) - ).deserialize(List[Authentication]) + resp = self.search_authentications_with_http_info( + authentication_search, request_options + ) + return resp.deserialize(List[Authentication], resp.raw_data) def search_destinations_with_http_info( self, @@ -8475,9 +8367,10 @@ def search_destinations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Destination]' result object. """ - return ( - self.search_destinations_with_http_info(destination_search, request_options) - ).deserialize(List[Destination]) + resp = self.search_destinations_with_http_info( + destination_search, request_options + ) + return resp.deserialize(List[Destination], resp.raw_data) def search_sources_with_http_info( self, @@ -8535,9 +8428,8 @@ def search_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Source]' result object. """ - return ( - self.search_sources_with_http_info(source_search, request_options) - ).deserialize(List[Source]) + resp = self.search_sources_with_http_info(source_search, request_options) + return resp.deserialize(List[Source], resp.raw_data) def search_tasks_with_http_info( self, @@ -8595,9 +8487,8 @@ def search_tasks( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Task]' result object. """ - return ( - self.search_tasks_with_http_info(task_search, request_options) - ).deserialize(List[Task]) + resp = self.search_tasks_with_http_info(task_search, request_options) + return resp.deserialize(List[Task], resp.raw_data) def search_tasks_v1_with_http_info( self, @@ -8655,9 +8546,8 @@ def search_tasks_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[TaskV1]' result object. """ - return ( - self.search_tasks_v1_with_http_info(task_search, request_options) - ).deserialize(List[TaskV1]) + resp = self.search_tasks_v1_with_http_info(task_search, request_options) + return resp.deserialize(List[TaskV1], resp.raw_data) def search_transformations_with_http_info( self, @@ -8715,11 +8605,10 @@ def search_transformations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Transformation]' result object. """ - return ( - self.search_transformations_with_http_info( - transformation_search, request_options - ) - ).deserialize(List[Transformation]) + resp = self.search_transformations_with_http_info( + transformation_search, request_options + ) + return resp.deserialize(List[Transformation], resp.raw_data) def trigger_docker_source_discover_with_http_info( self, @@ -8778,11 +8667,10 @@ def trigger_docker_source_discover( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceWatchResponse' result object. """ - return ( - self.trigger_docker_source_discover_with_http_info( - source_id, request_options - ) - ).deserialize(SourceWatchResponse) + resp = self.trigger_docker_source_discover_with_http_info( + source_id, request_options + ) + return resp.deserialize(SourceWatchResponse, resp.raw_data) def try_transformation_with_http_info( self, @@ -8840,9 +8728,10 @@ def try_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationTryResponse' result object. """ - return ( - self.try_transformation_with_http_info(transformation_try, request_options) - ).deserialize(TransformationTryResponse) + resp = self.try_transformation_with_http_info( + transformation_try, request_options + ) + return resp.deserialize(TransformationTryResponse, resp.raw_data) def try_transformation_before_update_with_http_info( self, @@ -8917,11 +8806,10 @@ def try_transformation_before_update( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationTryResponse' result object. """ - return ( - self.try_transformation_before_update_with_http_info( - transformation_id, transformation_try, request_options - ) - ).deserialize(TransformationTryResponse) + resp = self.try_transformation_before_update_with_http_info( + transformation_id, transformation_try, request_options + ) + return resp.deserialize(TransformationTryResponse, resp.raw_data) def update_authentication_with_http_info( self, @@ -8998,11 +8886,10 @@ def update_authentication( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AuthenticationUpdateResponse' result object. """ - return ( - self.update_authentication_with_http_info( - authentication_id, authentication_update, request_options - ) - ).deserialize(AuthenticationUpdateResponse) + resp = self.update_authentication_with_http_info( + authentication_id, authentication_update, request_options + ) + return resp.deserialize(AuthenticationUpdateResponse, resp.raw_data) def update_destination_with_http_info( self, @@ -9077,11 +8964,10 @@ def update_destination( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DestinationUpdateResponse' result object. """ - return ( - self.update_destination_with_http_info( - destination_id, destination_update, request_options - ) - ).deserialize(DestinationUpdateResponse) + resp = self.update_destination_with_http_info( + destination_id, destination_update, request_options + ) + return resp.deserialize(DestinationUpdateResponse, resp.raw_data) def update_source_with_http_info( self, @@ -9156,9 +9042,10 @@ def update_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceUpdateResponse' result object. """ - return ( - self.update_source_with_http_info(source_id, source_update, request_options) - ).deserialize(SourceUpdateResponse) + resp = self.update_source_with_http_info( + source_id, source_update, request_options + ) + return resp.deserialize(SourceUpdateResponse, resp.raw_data) def update_task_with_http_info( self, @@ -9223,9 +9110,8 @@ def update_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - self.update_task_with_http_info(task_id, task_update, request_options) - ).deserialize(TaskUpdateResponse) + resp = self.update_task_with_http_info(task_id, task_update, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) def update_task_v1_with_http_info( self, @@ -9290,9 +9176,8 @@ def update_task_v1( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TaskUpdateResponse' result object. """ - return ( - self.update_task_v1_with_http_info(task_id, task_update, request_options) - ).deserialize(TaskUpdateResponse) + resp = self.update_task_v1_with_http_info(task_id, task_update, request_options) + return resp.deserialize(TaskUpdateResponse, resp.raw_data) def update_transformation_with_http_info( self, @@ -9359,11 +9244,10 @@ def update_transformation( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'TransformationUpdateResponse' result object. """ - return ( - self.update_transformation_with_http_info( - transformation_id, transformation_create, request_options - ) - ).deserialize(TransformationUpdateResponse) + resp = self.update_transformation_with_http_info( + transformation_id, transformation_create, request_options + ) + return resp.deserialize(TransformationUpdateResponse, resp.raw_data) def validate_source_with_http_info( self, @@ -9416,9 +9300,8 @@ def validate_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceWatchResponse' result object. """ - return ( - self.validate_source_with_http_info(source_create, request_options) - ).deserialize(SourceWatchResponse) + resp = self.validate_source_with_http_info(source_create, request_options) + return resp.deserialize(SourceWatchResponse, resp.raw_data) def validate_source_before_update_with_http_info( self, @@ -9493,8 +9376,7 @@ def validate_source_before_update( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SourceWatchResponse' result object. """ - return ( - self.validate_source_before_update_with_http_info( - source_id, source_update, request_options - ) - ).deserialize(SourceWatchResponse) + resp = self.validate_source_before_update_with_http_info( + source_id, source_update, request_options + ) + return resp.deserialize(SourceWatchResponse, resp.raw_data) diff --git a/algoliasearch/insights/client.py b/algoliasearch/insights/client.py index 3442c4c3e..8aeb9e9a7 100644 --- a/algoliasearch/insights/client.py +++ b/algoliasearch/insights/client.py @@ -71,9 +71,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: InsightsConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: InsightsConfig, transporter: Optional[Transporter] = None + ) -> InsightsClient: """Allows creating a client with a customized `InsightsConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -98,7 +99,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -185,9 +186,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -259,9 +261,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -350,11 +351,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -443,11 +443,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_user_token_with_http_info( self, @@ -509,9 +508,8 @@ async def delete_user_token( :type user_token: str :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) """ - return ( - await self.delete_user_token_with_http_info(user_token, request_options) - ).deserialize() + resp = await self.delete_user_token_with_http_info(user_token, request_options) + return resp.deserialize(None, resp.raw_data) async def push_events_with_http_info( self, @@ -561,9 +559,8 @@ async def push_events( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'EventsResponse' result object. """ - return ( - await self.push_events_with_http_info(insights_events, request_options) - ).deserialize(EventsResponse) + resp = await self.push_events_with_http_info(insights_events, request_options) + return resp.deserialize(EventsResponse, resp.raw_data) class InsightsClientSync: @@ -608,9 +605,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: InsightsConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: InsightsConfig, transporter: Optional[TransporterSync] = None + ) -> InsightsClientSync: """Allows creating a client with a customized `InsightsConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -721,9 +719,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -795,9 +792,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -886,9 +882,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -977,9 +972,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_user_token_with_http_info( self, @@ -1041,9 +1035,8 @@ def delete_user_token( :type user_token: str :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) """ - return ( - self.delete_user_token_with_http_info(user_token, request_options) - ).deserialize() + resp = self.delete_user_token_with_http_info(user_token, request_options) + return resp.deserialize(None, resp.raw_data) def push_events_with_http_info( self, @@ -1093,6 +1086,5 @@ def push_events( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'EventsResponse' result object. """ - return ( - self.push_events_with_http_info(insights_events, request_options) - ).deserialize(EventsResponse) + resp = self.push_events_with_http_info(insights_events, request_options) + return resp.deserialize(EventsResponse, resp.raw_data) diff --git a/algoliasearch/monitoring/client.py b/algoliasearch/monitoring/client.py index 3485cc00b..910aa1408 100644 --- a/algoliasearch/monitoring/client.py +++ b/algoliasearch/monitoring/client.py @@ -78,9 +78,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: MonitoringConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: MonitoringConfig, transporter: Optional[Transporter] = None + ) -> MonitoringClient: """Allows creating a client with a customized `MonitoringConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -104,7 +105,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -191,9 +192,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -265,9 +267,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -356,11 +357,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -449,11 +449,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def get_cluster_incidents_with_http_info( self, @@ -504,9 +503,10 @@ async def get_cluster_incidents( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'IncidentsResponse' result object. """ - return ( - await self.get_cluster_incidents_with_http_info(clusters, request_options) - ).deserialize(IncidentsResponse) + resp = await self.get_cluster_incidents_with_http_info( + clusters, request_options + ) + return resp.deserialize(IncidentsResponse, resp.raw_data) async def get_cluster_status_with_http_info( self, @@ -557,9 +557,8 @@ async def get_cluster_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'StatusResponse' result object. """ - return ( - await self.get_cluster_status_with_http_info(clusters, request_options) - ).deserialize(StatusResponse) + resp = await self.get_cluster_status_with_http_info(clusters, request_options) + return resp.deserialize(StatusResponse, resp.raw_data) async def get_incidents_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -591,9 +590,8 @@ async def get_incidents( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'IncidentsResponse' result object. """ - return (await self.get_incidents_with_http_info(request_options)).deserialize( - IncidentsResponse - ) + resp = await self.get_incidents_with_http_info(request_options) + return resp.deserialize(IncidentsResponse, resp.raw_data) async def get_indexing_time_with_http_info( self, @@ -644,9 +642,8 @@ async def get_indexing_time( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'IndexingTimeResponse' result object. """ - return ( - await self.get_indexing_time_with_http_info(clusters, request_options) - ).deserialize(IndexingTimeResponse) + resp = await self.get_indexing_time_with_http_info(clusters, request_options) + return resp.deserialize(IndexingTimeResponse, resp.raw_data) async def get_latency_with_http_info( self, @@ -697,9 +694,8 @@ async def get_latency( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'LatencyResponse' result object. """ - return ( - await self.get_latency_with_http_info(clusters, request_options) - ).deserialize(LatencyResponse) + resp = await self.get_latency_with_http_info(clusters, request_options) + return resp.deserialize(LatencyResponse, resp.raw_data) async def get_metrics_with_http_info( self, @@ -777,9 +773,8 @@ async def get_metrics( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'InfrastructureResponse' result object. """ - return ( - await self.get_metrics_with_http_info(metric, period, request_options) - ).deserialize(InfrastructureResponse) + resp = await self.get_metrics_with_http_info(metric, period, request_options) + return resp.deserialize(InfrastructureResponse, resp.raw_data) async def get_reachability_with_http_info( self, @@ -830,9 +825,8 @@ async def get_reachability( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Dict[str, Dict[str, bool]]' result object. """ - return ( - await self.get_reachability_with_http_info(clusters, request_options) - ).deserialize(Dict[str, Dict[str, bool]]) + resp = await self.get_reachability_with_http_info(clusters, request_options) + return resp.deserialize(Dict[str, Dict[str, bool]], resp.raw_data) async def get_servers_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -864,9 +858,8 @@ async def get_servers( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'InventoryResponse' result object. """ - return (await self.get_servers_with_http_info(request_options)).deserialize( - InventoryResponse - ) + resp = await self.get_servers_with_http_info(request_options) + return resp.deserialize(InventoryResponse, resp.raw_data) async def get_status_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -898,9 +891,8 @@ async def get_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'StatusResponse' result object. """ - return (await self.get_status_with_http_info(request_options)).deserialize( - StatusResponse - ) + resp = await self.get_status_with_http_info(request_options) + return resp.deserialize(StatusResponse, resp.raw_data) class MonitoringClientSync: @@ -944,9 +936,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: MonitoringConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: MonitoringConfig, transporter: Optional[TransporterSync] = None + ) -> MonitoringClientSync: """Allows creating a client with a customized `MonitoringConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -1056,9 +1049,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -1130,9 +1122,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -1221,9 +1212,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -1312,9 +1302,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def get_cluster_incidents_with_http_info( self, @@ -1365,9 +1354,8 @@ def get_cluster_incidents( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'IncidentsResponse' result object. """ - return ( - self.get_cluster_incidents_with_http_info(clusters, request_options) - ).deserialize(IncidentsResponse) + resp = self.get_cluster_incidents_with_http_info(clusters, request_options) + return resp.deserialize(IncidentsResponse, resp.raw_data) def get_cluster_status_with_http_info( self, @@ -1418,9 +1406,8 @@ def get_cluster_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'StatusResponse' result object. """ - return ( - self.get_cluster_status_with_http_info(clusters, request_options) - ).deserialize(StatusResponse) + resp = self.get_cluster_status_with_http_info(clusters, request_options) + return resp.deserialize(StatusResponse, resp.raw_data) def get_incidents_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -1452,9 +1439,8 @@ def get_incidents( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'IncidentsResponse' result object. """ - return (self.get_incidents_with_http_info(request_options)).deserialize( - IncidentsResponse - ) + resp = self.get_incidents_with_http_info(request_options) + return resp.deserialize(IncidentsResponse, resp.raw_data) def get_indexing_time_with_http_info( self, @@ -1505,9 +1491,8 @@ def get_indexing_time( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'IndexingTimeResponse' result object. """ - return ( - self.get_indexing_time_with_http_info(clusters, request_options) - ).deserialize(IndexingTimeResponse) + resp = self.get_indexing_time_with_http_info(clusters, request_options) + return resp.deserialize(IndexingTimeResponse, resp.raw_data) def get_latency_with_http_info( self, @@ -1558,9 +1543,8 @@ def get_latency( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'LatencyResponse' result object. """ - return (self.get_latency_with_http_info(clusters, request_options)).deserialize( - LatencyResponse - ) + resp = self.get_latency_with_http_info(clusters, request_options) + return resp.deserialize(LatencyResponse, resp.raw_data) def get_metrics_with_http_info( self, @@ -1638,9 +1622,8 @@ def get_metrics( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'InfrastructureResponse' result object. """ - return ( - self.get_metrics_with_http_info(metric, period, request_options) - ).deserialize(InfrastructureResponse) + resp = self.get_metrics_with_http_info(metric, period, request_options) + return resp.deserialize(InfrastructureResponse, resp.raw_data) def get_reachability_with_http_info( self, @@ -1691,9 +1674,8 @@ def get_reachability( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Dict[str, Dict[str, bool]]' result object. """ - return ( - self.get_reachability_with_http_info(clusters, request_options) - ).deserialize(Dict[str, Dict[str, bool]]) + resp = self.get_reachability_with_http_info(clusters, request_options) + return resp.deserialize(Dict[str, Dict[str, bool]], resp.raw_data) def get_servers_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -1725,9 +1707,8 @@ def get_servers( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'InventoryResponse' result object. """ - return (self.get_servers_with_http_info(request_options)).deserialize( - InventoryResponse - ) + resp = self.get_servers_with_http_info(request_options) + return resp.deserialize(InventoryResponse, resp.raw_data) def get_status_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -1759,6 +1740,5 @@ def get_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'StatusResponse' result object. """ - return (self.get_status_with_http_info(request_options)).deserialize( - StatusResponse - ) + resp = self.get_status_with_http_info(request_options) + return resp.deserialize(StatusResponse, resp.raw_data) diff --git a/algoliasearch/personalization/client.py b/algoliasearch/personalization/client.py index 7db9e5a1f..6dc786d35 100644 --- a/algoliasearch/personalization/client.py +++ b/algoliasearch/personalization/client.py @@ -81,9 +81,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: PersonalizationConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: PersonalizationConfig, transporter: Optional[Transporter] = None + ) -> PersonalizationClient: """Allows creating a client with a customized `PersonalizationConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -108,7 +109,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -195,9 +196,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -269,9 +271,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -360,11 +361,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -453,11 +453,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_user_profile_with_http_info( self, @@ -518,9 +517,10 @@ async def delete_user_profile( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteUserProfileResponse' result object. """ - return ( - await self.delete_user_profile_with_http_info(user_token, request_options) - ).deserialize(DeleteUserProfileResponse) + resp = await self.delete_user_profile_with_http_info( + user_token, request_options + ) + return resp.deserialize(DeleteUserProfileResponse, resp.raw_data) async def get_personalization_strategy_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -556,9 +556,8 @@ async def get_personalization_strategy( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'PersonalizationStrategyParams' result object. """ - return ( - await self.get_personalization_strategy_with_http_info(request_options) - ).deserialize(PersonalizationStrategyParams) + resp = await self.get_personalization_strategy_with_http_info(request_options) + return resp.deserialize(PersonalizationStrategyParams, resp.raw_data) async def get_user_token_profile_with_http_info( self, @@ -619,11 +618,10 @@ async def get_user_token_profile( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetUserTokenResponse' result object. """ - return ( - await self.get_user_token_profile_with_http_info( - user_token, request_options - ) - ).deserialize(GetUserTokenResponse) + resp = await self.get_user_token_profile_with_http_info( + user_token, request_options + ) + return resp.deserialize(GetUserTokenResponse, resp.raw_data) async def set_personalization_strategy_with_http_info( self, @@ -677,11 +675,10 @@ async def set_personalization_strategy( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SetPersonalizationStrategyResponse' result object. """ - return ( - await self.set_personalization_strategy_with_http_info( - personalization_strategy_params, request_options - ) - ).deserialize(SetPersonalizationStrategyResponse) + resp = await self.set_personalization_strategy_with_http_info( + personalization_strategy_params, request_options + ) + return resp.deserialize(SetPersonalizationStrategyResponse, resp.raw_data) class PersonalizationClientSync: @@ -726,9 +723,12 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: PersonalizationConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, + config: PersonalizationConfig, + transporter: Optional[TransporterSync] = None, + ) -> PersonalizationClientSync: """Allows creating a client with a customized `PersonalizationConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -839,9 +839,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -913,9 +912,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -1004,9 +1002,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -1095,9 +1092,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_user_profile_with_http_info( self, @@ -1158,9 +1154,8 @@ def delete_user_profile( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteUserProfileResponse' result object. """ - return ( - self.delete_user_profile_with_http_info(user_token, request_options) - ).deserialize(DeleteUserProfileResponse) + resp = self.delete_user_profile_with_http_info(user_token, request_options) + return resp.deserialize(DeleteUserProfileResponse, resp.raw_data) def get_personalization_strategy_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -1196,9 +1191,8 @@ def get_personalization_strategy( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'PersonalizationStrategyParams' result object. """ - return ( - self.get_personalization_strategy_with_http_info(request_options) - ).deserialize(PersonalizationStrategyParams) + resp = self.get_personalization_strategy_with_http_info(request_options) + return resp.deserialize(PersonalizationStrategyParams, resp.raw_data) def get_user_token_profile_with_http_info( self, @@ -1259,9 +1253,8 @@ def get_user_token_profile( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetUserTokenResponse' result object. """ - return ( - self.get_user_token_profile_with_http_info(user_token, request_options) - ).deserialize(GetUserTokenResponse) + resp = self.get_user_token_profile_with_http_info(user_token, request_options) + return resp.deserialize(GetUserTokenResponse, resp.raw_data) def set_personalization_strategy_with_http_info( self, @@ -1315,8 +1308,7 @@ def set_personalization_strategy( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SetPersonalizationStrategyResponse' result object. """ - return ( - self.set_personalization_strategy_with_http_info( - personalization_strategy_params, request_options - ) - ).deserialize(SetPersonalizationStrategyResponse) + resp = self.set_personalization_strategy_with_http_info( + personalization_strategy_params, request_options + ) + return resp.deserialize(SetPersonalizationStrategyResponse, resp.raw_data) diff --git a/algoliasearch/query_suggestions/client.py b/algoliasearch/query_suggestions/client.py index 769a6e15a..1ae4a6137 100644 --- a/algoliasearch/query_suggestions/client.py +++ b/algoliasearch/query_suggestions/client.py @@ -79,9 +79,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: QuerySuggestionsConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: QuerySuggestionsConfig, transporter: Optional[Transporter] = None + ) -> QuerySuggestionsClient: """Allows creating a client with a customized `QuerySuggestionsConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -106,7 +107,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -173,11 +174,10 @@ async def create_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BaseResponse' result object. """ - return ( - await self.create_config_with_http_info( - configuration_with_index, request_options - ) - ).deserialize(BaseResponse) + resp = await self.create_config_with_http_info( + configuration_with_index, request_options + ) + return resp.deserialize(BaseResponse, resp.raw_data) async def custom_delete_with_http_info( self, @@ -251,9 +251,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -325,9 +326,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -416,11 +416,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -509,11 +508,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_config_with_http_info( self, @@ -568,9 +566,8 @@ async def delete_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BaseResponse' result object. """ - return ( - await self.delete_config_with_http_info(index_name, request_options) - ).deserialize(BaseResponse) + resp = await self.delete_config_with_http_info(index_name, request_options) + return resp.deserialize(BaseResponse, resp.raw_data) async def get_all_configs_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -606,9 +603,8 @@ async def get_all_configs( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[ConfigurationResponse]' result object. """ - return (await self.get_all_configs_with_http_info(request_options)).deserialize( - List[ConfigurationResponse] - ) + resp = await self.get_all_configs_with_http_info(request_options) + return resp.deserialize(List[ConfigurationResponse], resp.raw_data) async def get_config_with_http_info( self, @@ -663,9 +659,8 @@ async def get_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ConfigurationResponse' result object. """ - return ( - await self.get_config_with_http_info(index_name, request_options) - ).deserialize(ConfigurationResponse) + resp = await self.get_config_with_http_info(index_name, request_options) + return resp.deserialize(ConfigurationResponse, resp.raw_data) async def get_config_status_with_http_info( self, @@ -720,9 +715,8 @@ async def get_config_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ConfigStatus' result object. """ - return ( - await self.get_config_status_with_http_info(index_name, request_options) - ).deserialize(ConfigStatus) + resp = await self.get_config_status_with_http_info(index_name, request_options) + return resp.deserialize(ConfigStatus, resp.raw_data) async def get_log_file_with_http_info( self, @@ -777,9 +771,8 @@ async def get_log_file( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'LogFile' result object. """ - return ( - await self.get_log_file_with_http_info(index_name, request_options) - ).deserialize(LogFile) + resp = await self.get_log_file_with_http_info(index_name, request_options) + return resp.deserialize(LogFile, resp.raw_data) async def update_config_with_http_info( self, @@ -850,11 +843,10 @@ async def update_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BaseResponse' result object. """ - return ( - await self.update_config_with_http_info( - index_name, configuration, request_options - ) - ).deserialize(BaseResponse) + resp = await self.update_config_with_http_info( + index_name, configuration, request_options + ) + return resp.deserialize(BaseResponse, resp.raw_data) class QuerySuggestionsClientSync: @@ -899,9 +891,12 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: QuerySuggestionsConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, + config: QuerySuggestionsConfig, + transporter: Optional[TransporterSync] = None, + ) -> QuerySuggestionsClientSync: """Allows creating a client with a customized `QuerySuggestionsConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -992,9 +987,10 @@ def create_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BaseResponse' result object. """ - return ( - self.create_config_with_http_info(configuration_with_index, request_options) - ).deserialize(BaseResponse) + resp = self.create_config_with_http_info( + configuration_with_index, request_options + ) + return resp.deserialize(BaseResponse, resp.raw_data) def custom_delete_with_http_info( self, @@ -1068,9 +1064,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -1142,9 +1137,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -1233,9 +1227,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -1324,9 +1317,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_config_with_http_info( self, @@ -1381,9 +1373,8 @@ def delete_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BaseResponse' result object. """ - return ( - self.delete_config_with_http_info(index_name, request_options) - ).deserialize(BaseResponse) + resp = self.delete_config_with_http_info(index_name, request_options) + return resp.deserialize(BaseResponse, resp.raw_data) def get_all_configs_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -1419,9 +1410,8 @@ def get_all_configs( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[ConfigurationResponse]' result object. """ - return (self.get_all_configs_with_http_info(request_options)).deserialize( - List[ConfigurationResponse] - ) + resp = self.get_all_configs_with_http_info(request_options) + return resp.deserialize(List[ConfigurationResponse], resp.raw_data) def get_config_with_http_info( self, @@ -1476,9 +1466,8 @@ def get_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ConfigurationResponse' result object. """ - return ( - self.get_config_with_http_info(index_name, request_options) - ).deserialize(ConfigurationResponse) + resp = self.get_config_with_http_info(index_name, request_options) + return resp.deserialize(ConfigurationResponse, resp.raw_data) def get_config_status_with_http_info( self, @@ -1533,9 +1522,8 @@ def get_config_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ConfigStatus' result object. """ - return ( - self.get_config_status_with_http_info(index_name, request_options) - ).deserialize(ConfigStatus) + resp = self.get_config_status_with_http_info(index_name, request_options) + return resp.deserialize(ConfigStatus, resp.raw_data) def get_log_file_with_http_info( self, @@ -1590,9 +1578,8 @@ def get_log_file( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'LogFile' result object. """ - return ( - self.get_log_file_with_http_info(index_name, request_options) - ).deserialize(LogFile) + resp = self.get_log_file_with_http_info(index_name, request_options) + return resp.deserialize(LogFile, resp.raw_data) def update_config_with_http_info( self, @@ -1663,8 +1650,7 @@ def update_config( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BaseResponse' result object. """ - return ( - self.update_config_with_http_info( - index_name, configuration, request_options - ) - ).deserialize(BaseResponse) + resp = self.update_config_with_http_info( + index_name, configuration, request_options + ) + return resp.deserialize(BaseResponse, resp.raw_data) diff --git a/algoliasearch/recommend/client.py b/algoliasearch/recommend/client.py index 9a3a0c339..5ba5f9435 100644 --- a/algoliasearch/recommend/client.py +++ b/algoliasearch/recommend/client.py @@ -86,9 +86,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: RecommendConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: RecommendConfig, transporter: Optional[Transporter] = None + ) -> RecommendClient: """Allows creating a client with a customized `RecommendConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -112,7 +113,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -199,9 +200,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -273,9 +275,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -364,11 +365,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -457,11 +457,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_recommend_rule_with_http_info( self, @@ -552,11 +551,10 @@ async def delete_recommend_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - await self.delete_recommend_rule_with_http_info( - index_name, model, object_id, request_options - ) - ).deserialize(DeletedAtResponse) + resp = await self.delete_recommend_rule_with_http_info( + index_name, model, object_id, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) async def get_recommend_rule_with_http_info( self, @@ -647,11 +645,10 @@ async def get_recommend_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RecommendRule' result object. """ - return ( - await self.get_recommend_rule_with_http_info( - index_name, model, object_id, request_options - ) - ).deserialize(RecommendRule) + resp = await self.get_recommend_rule_with_http_info( + index_name, model, object_id, request_options + ) + return resp.deserialize(RecommendRule, resp.raw_data) async def get_recommend_status_with_http_info( self, @@ -742,11 +739,10 @@ async def get_recommend_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetRecommendTaskResponse' result object. """ - return ( - await self.get_recommend_status_with_http_info( - index_name, model, task_id, request_options - ) - ).deserialize(GetRecommendTaskResponse) + resp = await self.get_recommend_status_with_http_info( + index_name, model, task_id, request_options + ) + return resp.deserialize(GetRecommendTaskResponse, resp.raw_data) async def get_recommendations_with_http_info( self, @@ -800,11 +796,10 @@ async def get_recommendations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetRecommendationsResponse' result object. """ - return ( - await self.get_recommendations_with_http_info( - get_recommendations_params, request_options - ) - ).deserialize(GetRecommendationsResponse) + resp = await self.get_recommendations_with_http_info( + get_recommendations_params, request_options + ) + return resp.deserialize(GetRecommendationsResponse, resp.raw_data) async def search_recommend_rules_with_http_info( self, @@ -893,11 +888,10 @@ async def search_recommend_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchRecommendRulesResponse' result object. """ - return ( - await self.search_recommend_rules_with_http_info( - index_name, model, search_recommend_rules_params, request_options - ) - ).deserialize(SearchRecommendRulesResponse) + resp = await self.search_recommend_rules_with_http_info( + index_name, model, search_recommend_rules_params, request_options + ) + return resp.deserialize(SearchRecommendRulesResponse, resp.raw_data) class RecommendClientSync: @@ -941,9 +935,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: RecommendConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: RecommendConfig, transporter: Optional[TransporterSync] = None + ) -> RecommendClientSync: """Allows creating a client with a customized `RecommendConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -1053,9 +1048,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -1127,9 +1121,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -1218,9 +1211,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -1309,9 +1301,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_recommend_rule_with_http_info( self, @@ -1402,11 +1393,10 @@ def delete_recommend_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - self.delete_recommend_rule_with_http_info( - index_name, model, object_id, request_options - ) - ).deserialize(DeletedAtResponse) + resp = self.delete_recommend_rule_with_http_info( + index_name, model, object_id, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) def get_recommend_rule_with_http_info( self, @@ -1497,11 +1487,10 @@ def get_recommend_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RecommendRule' result object. """ - return ( - self.get_recommend_rule_with_http_info( - index_name, model, object_id, request_options - ) - ).deserialize(RecommendRule) + resp = self.get_recommend_rule_with_http_info( + index_name, model, object_id, request_options + ) + return resp.deserialize(RecommendRule, resp.raw_data) def get_recommend_status_with_http_info( self, @@ -1592,11 +1581,10 @@ def get_recommend_status( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetRecommendTaskResponse' result object. """ - return ( - self.get_recommend_status_with_http_info( - index_name, model, task_id, request_options - ) - ).deserialize(GetRecommendTaskResponse) + resp = self.get_recommend_status_with_http_info( + index_name, model, task_id, request_options + ) + return resp.deserialize(GetRecommendTaskResponse, resp.raw_data) def get_recommendations_with_http_info( self, @@ -1650,11 +1638,10 @@ def get_recommendations( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetRecommendationsResponse' result object. """ - return ( - self.get_recommendations_with_http_info( - get_recommendations_params, request_options - ) - ).deserialize(GetRecommendationsResponse) + resp = self.get_recommendations_with_http_info( + get_recommendations_params, request_options + ) + return resp.deserialize(GetRecommendationsResponse, resp.raw_data) def search_recommend_rules_with_http_info( self, @@ -1743,8 +1730,7 @@ def search_recommend_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchRecommendRulesResponse' result object. """ - return ( - self.search_recommend_rules_with_http_info( - index_name, model, search_recommend_rules_params, request_options - ) - ).deserialize(SearchRecommendRulesResponse) + resp = self.search_recommend_rules_with_http_info( + index_name, model, search_recommend_rules_params, request_options + ) + return resp.deserialize(SearchRecommendRulesResponse, resp.raw_data) diff --git a/algoliasearch/search/client.py b/algoliasearch/search/client.py index 21d9d8925..69bff4590 100644 --- a/algoliasearch/search/client.py +++ b/algoliasearch/search/client.py @@ -171,9 +171,10 @@ def __init__( transporter = Transporter(config) self._transporter = transporter + @classmethod def create_with_config( - config: SearchConfig, transporter: Optional[Transporter] = None - ) -> Self: + cls, config: SearchConfig, transporter: Optional[Transporter] = None + ) -> SearchClient: """Allows creating a client with a customized `SearchConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -197,7 +198,7 @@ def create_with_config( config=config, ) - async def __aenter__(self) -> None: + async def __aenter__(self) -> Self: return self async def __aexit__(self, exc_type, exc_value, traceback) -> None: @@ -236,7 +237,7 @@ def _aggregator(_: GetTaskResponse) -> None: aggregator=_aggregator, validate=lambda _resp: _resp.status == "published", timeout=lambda: timeout(self._retry_count), - error_validate=lambda x: self._retry_count >= max_retries, + error_validate=lambda _: self._retry_count >= max_retries, error_message=lambda: f"The maximum number of retries exceeded. (${self._retry_count}/${max_retries})", ) @@ -263,7 +264,7 @@ def _aggregator(_: GetTaskResponse) -> None: aggregator=_aggregator, validate=lambda _resp: _resp.status == "published", timeout=lambda: timeout(self._retry_count), - error_validate=lambda x: self._retry_count >= max_retries, + error_validate=lambda _: self._retry_count >= max_retries, error_message=lambda: f"The maximum number of retries exceeded. (${self._retry_count}/${max_retries})", ) @@ -670,9 +671,8 @@ async def add_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AddApiKeyResponse' result object. """ - return ( - await self.add_api_key_with_http_info(api_key, request_options) - ).deserialize(AddApiKeyResponse) + resp = await self.add_api_key_with_http_info(api_key, request_options) + return resp.deserialize(AddApiKeyResponse, resp.raw_data) async def add_or_update_object_with_http_info( self, @@ -766,11 +766,10 @@ async def add_or_update_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtWithObjectIdResponse' result object. """ - return ( - await self.add_or_update_object_with_http_info( - index_name, object_id, body, request_options - ) - ).deserialize(UpdatedAtWithObjectIdResponse) + resp = await self.add_or_update_object_with_http_info( + index_name, object_id, body, request_options + ) + return resp.deserialize(UpdatedAtWithObjectIdResponse, resp.raw_data) async def append_source_with_http_info( self, @@ -824,9 +823,8 @@ async def append_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'CreatedAtResponse' result object. """ - return ( - await self.append_source_with_http_info(source, request_options) - ).deserialize(CreatedAtResponse) + resp = await self.append_source_with_http_info(source, request_options) + return resp.deserialize(CreatedAtResponse, resp.raw_data) async def assign_user_id_with_http_info( self, @@ -909,11 +907,10 @@ async def assign_user_id( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'CreatedAtResponse' result object. """ - return ( - await self.assign_user_id_with_http_info( - x_algolia_user_id, assign_user_id_params, request_options - ) - ).deserialize(CreatedAtResponse) + resp = await self.assign_user_id_with_http_info( + x_algolia_user_id, assign_user_id_params, request_options + ) + return resp.deserialize(CreatedAtResponse, resp.raw_data) async def batch_with_http_info( self, @@ -980,11 +977,10 @@ async def batch( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BatchResponse' result object. """ - return ( - await self.batch_with_http_info( - index_name, batch_write_params, request_options - ) - ).deserialize(BatchResponse) + resp = await self.batch_with_http_info( + index_name, batch_write_params, request_options + ) + return resp.deserialize(BatchResponse, resp.raw_data) async def batch_assign_user_ids_with_http_info( self, @@ -1067,11 +1063,10 @@ async def batch_assign_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'CreatedAtResponse' result object. """ - return ( - await self.batch_assign_user_ids_with_http_info( - x_algolia_user_id, batch_assign_user_ids_params, request_options - ) - ).deserialize(CreatedAtResponse) + resp = await self.batch_assign_user_ids_with_http_info( + x_algolia_user_id, batch_assign_user_ids_params, request_options + ) + return resp.deserialize(CreatedAtResponse, resp.raw_data) async def batch_dictionary_entries_with_http_info( self, @@ -1142,11 +1137,10 @@ async def batch_dictionary_entries( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.batch_dictionary_entries_with_http_info( - dictionary_name, batch_dictionary_entries_params, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.batch_dictionary_entries_with_http_info( + dictionary_name, batch_dictionary_entries_params, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def browse_with_http_info( self, @@ -1214,9 +1208,10 @@ async def browse( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BrowseResponse' result object. """ - return ( - await self.browse_with_http_info(index_name, browse_params, request_options) - ).deserialize(BrowseResponse) + resp = await self.browse_with_http_info( + index_name, browse_params, request_options + ) + return resp.deserialize(BrowseResponse, resp.raw_data) async def clear_objects_with_http_info( self, @@ -1273,9 +1268,8 @@ async def clear_objects( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.clear_objects_with_http_info(index_name, request_options) - ).deserialize(UpdatedAtResponse) + resp = await self.clear_objects_with_http_info(index_name, request_options) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def clear_rules_with_http_info( self, @@ -1350,11 +1344,10 @@ async def clear_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.clear_rules_with_http_info( - index_name, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.clear_rules_with_http_info( + index_name, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def clear_synonyms_with_http_info( self, @@ -1429,11 +1422,10 @@ async def clear_synonyms( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.clear_synonyms_with_http_info( - index_name, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.clear_synonyms_with_http_info( + index_name, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def custom_delete_with_http_info( self, @@ -1507,9 +1499,10 @@ async def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_delete_with_http_info( + path, parameters, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_get_with_http_info( self, @@ -1581,9 +1574,8 @@ async def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = await self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) async def custom_post_with_http_info( self, @@ -1672,11 +1664,10 @@ async def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_post_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def custom_put_with_http_info( self, @@ -1765,11 +1756,10 @@ async def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) + resp = await self.custom_put_with_http_info( + path, parameters, body, request_options + ) + return resp.deserialize(object, resp.raw_data) async def delete_api_key_with_http_info( self, @@ -1818,9 +1808,8 @@ async def delete_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteApiKeyResponse' result object. """ - return ( - await self.delete_api_key_with_http_info(key, request_options) - ).deserialize(DeleteApiKeyResponse) + resp = await self.delete_api_key_with_http_info(key, request_options) + return resp.deserialize(DeleteApiKeyResponse, resp.raw_data) async def delete_by_with_http_info( self, @@ -1893,11 +1882,10 @@ async def delete_by( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - await self.delete_by_with_http_info( - index_name, delete_by_params, request_options - ) - ).deserialize(DeletedAtResponse) + resp = await self.delete_by_with_http_info( + index_name, delete_by_params, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) async def delete_index_with_http_info( self, @@ -1954,9 +1942,8 @@ async def delete_index( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - await self.delete_index_with_http_info(index_name, request_options) - ).deserialize(DeletedAtResponse) + resp = await self.delete_index_with_http_info(index_name, request_options) + return resp.deserialize(DeletedAtResponse, resp.raw_data) async def delete_object_with_http_info( self, @@ -2024,11 +2011,10 @@ async def delete_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - await self.delete_object_with_http_info( - index_name, object_id, request_options - ) - ).deserialize(DeletedAtResponse) + resp = await self.delete_object_with_http_info( + index_name, object_id, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) async def delete_rule_with_http_info( self, @@ -2118,11 +2104,10 @@ async def delete_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.delete_rule_with_http_info( - index_name, object_id, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.delete_rule_with_http_info( + index_name, object_id, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def delete_source_with_http_info( self, @@ -2177,9 +2162,8 @@ async def delete_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteSourceResponse' result object. """ - return ( - await self.delete_source_with_http_info(source, request_options) - ).deserialize(DeleteSourceResponse) + resp = await self.delete_source_with_http_info(source, request_options) + return resp.deserialize(DeleteSourceResponse, resp.raw_data) async def delete_synonym_with_http_info( self, @@ -2269,11 +2253,10 @@ async def delete_synonym( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - await self.delete_synonym_with_http_info( - index_name, object_id, forward_to_replicas, request_options - ) - ).deserialize(DeletedAtResponse) + resp = await self.delete_synonym_with_http_info( + index_name, object_id, forward_to_replicas, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) async def get_api_key_with_http_info( self, @@ -2316,9 +2299,8 @@ async def get_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetApiKeyResponse' result object. """ - return ( - await self.get_api_key_with_http_info(key, request_options) - ).deserialize(GetApiKeyResponse) + resp = await self.get_api_key_with_http_info(key, request_options) + return resp.deserialize(GetApiKeyResponse, resp.raw_data) async def get_app_task_with_http_info( self, @@ -2367,9 +2349,8 @@ async def get_app_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTaskResponse' result object. """ - return ( - await self.get_app_task_with_http_info(task_id, request_options) - ).deserialize(GetTaskResponse) + resp = await self.get_app_task_with_http_info(task_id, request_options) + return resp.deserialize(GetTaskResponse, resp.raw_data) async def get_dictionary_languages_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -2405,9 +2386,8 @@ async def get_dictionary_languages( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Dict[str, Languages]' result object. """ - return ( - await self.get_dictionary_languages_with_http_info(request_options) - ).deserialize(Dict[str, Languages]) + resp = await self.get_dictionary_languages_with_http_info(request_options) + return resp.deserialize(Dict[str, Languages], resp.raw_data) async def get_dictionary_settings_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -2443,9 +2423,8 @@ async def get_dictionary_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetDictionarySettingsResponse' result object. """ - return ( - await self.get_dictionary_settings_with_http_info(request_options) - ).deserialize(GetDictionarySettingsResponse) + resp = await self.get_dictionary_settings_with_http_info(request_options) + return resp.deserialize(GetDictionarySettingsResponse, resp.raw_data) async def get_logs_with_http_info( self, @@ -2555,11 +2534,10 @@ async def get_logs( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetLogsResponse' result object. """ - return ( - await self.get_logs_with_http_info( - offset, length, index_name, type, request_options - ) - ).deserialize(GetLogsResponse) + resp = await self.get_logs_with_http_info( + offset, length, index_name, type, request_options + ) + return resp.deserialize(GetLogsResponse, resp.raw_data) async def get_object_with_http_info( self, @@ -2649,11 +2627,10 @@ async def get_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - await self.get_object_with_http_info( - index_name, object_id, attributes_to_retrieve, request_options - ) - ).deserialize(object) + resp = await self.get_object_with_http_info( + index_name, object_id, attributes_to_retrieve, request_options + ) + return resp.deserialize(object, resp.raw_data) async def get_objects_with_http_info( self, @@ -2711,9 +2688,10 @@ async def get_objects( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetObjectsResponse' result object. """ - return ( - await self.get_objects_with_http_info(get_objects_params, request_options) - ).deserialize(GetObjectsResponse) + resp = await self.get_objects_with_http_info( + get_objects_params, request_options + ) + return resp.deserialize(GetObjectsResponse, resp.raw_data) async def get_rule_with_http_info( self, @@ -2785,9 +2763,10 @@ async def get_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Rule' result object. """ - return ( - await self.get_rule_with_http_info(index_name, object_id, request_options) - ).deserialize(Rule) + resp = await self.get_rule_with_http_info( + index_name, object_id, request_options + ) + return resp.deserialize(Rule, resp.raw_data) async def get_settings_with_http_info( self, @@ -2844,9 +2823,8 @@ async def get_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SettingsResponse' result object. """ - return ( - await self.get_settings_with_http_info(index_name, request_options) - ).deserialize(SettingsResponse) + resp = await self.get_settings_with_http_info(index_name, request_options) + return resp.deserialize(SettingsResponse, resp.raw_data) async def get_sources_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -2882,9 +2860,8 @@ async def get_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Source]' result object. """ - return (await self.get_sources_with_http_info(request_options)).deserialize( - List[Source] - ) + resp = await self.get_sources_with_http_info(request_options) + return resp.deserialize(List[Source], resp.raw_data) async def get_synonym_with_http_info( self, @@ -2956,11 +2933,10 @@ async def get_synonym( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SynonymHit' result object. """ - return ( - await self.get_synonym_with_http_info( - index_name, object_id, request_options - ) - ).deserialize(SynonymHit) + resp = await self.get_synonym_with_http_info( + index_name, object_id, request_options + ) + return resp.deserialize(SynonymHit, resp.raw_data) async def get_task_with_http_info( self, @@ -3026,9 +3002,8 @@ async def get_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTaskResponse' result object. """ - return ( - await self.get_task_with_http_info(index_name, task_id, request_options) - ).deserialize(GetTaskResponse) + resp = await self.get_task_with_http_info(index_name, task_id, request_options) + return resp.deserialize(GetTaskResponse, resp.raw_data) async def get_top_user_ids_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -3064,9 +3039,8 @@ async def get_top_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopUserIdsResponse' result object. """ - return ( - await self.get_top_user_ids_with_http_info(request_options) - ).deserialize(GetTopUserIdsResponse) + resp = await self.get_top_user_ids_with_http_info(request_options) + return resp.deserialize(GetTopUserIdsResponse, resp.raw_data) async def get_user_id_with_http_info( self, @@ -3129,9 +3103,8 @@ async def get_user_id( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UserId' result object. """ - return ( - await self.get_user_id_with_http_info(user_id, request_options) - ).deserialize(UserId) + resp = await self.get_user_id_with_http_info(user_id, request_options) + return resp.deserialize(UserId, resp.raw_data) async def has_pending_mappings_with_http_info( self, @@ -3191,11 +3164,10 @@ async def has_pending_mappings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'HasPendingMappingsResponse' result object. """ - return ( - await self.has_pending_mappings_with_http_info( - get_clusters, request_options - ) - ).deserialize(HasPendingMappingsResponse) + resp = await self.has_pending_mappings_with_http_info( + get_clusters, request_options + ) + return resp.deserialize(HasPendingMappingsResponse, resp.raw_data) async def list_api_keys_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -3231,9 +3203,8 @@ async def list_api_keys( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListApiKeysResponse' result object. """ - return (await self.list_api_keys_with_http_info(request_options)).deserialize( - ListApiKeysResponse - ) + resp = await self.list_api_keys_with_http_info(request_options) + return resp.deserialize(ListApiKeysResponse, resp.raw_data) async def list_clusters_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -3269,9 +3240,8 @@ async def list_clusters( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListClustersResponse' result object. """ - return (await self.list_clusters_with_http_info(request_options)).deserialize( - ListClustersResponse - ) + resp = await self.list_clusters_with_http_info(request_options) + return resp.deserialize(ListClustersResponse, resp.raw_data) async def list_indices_with_http_info( self, @@ -3343,9 +3313,10 @@ async def list_indices( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListIndicesResponse' result object. """ - return ( - await self.list_indices_with_http_info(page, hits_per_page, request_options) - ).deserialize(ListIndicesResponse) + resp = await self.list_indices_with_http_info( + page, hits_per_page, request_options + ) + return resp.deserialize(ListIndicesResponse, resp.raw_data) async def list_user_ids_with_http_info( self, @@ -3417,11 +3388,10 @@ async def list_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListUserIdsResponse' result object. """ - return ( - await self.list_user_ids_with_http_info( - page, hits_per_page, request_options - ) - ).deserialize(ListUserIdsResponse) + resp = await self.list_user_ids_with_http_info( + page, hits_per_page, request_options + ) + return resp.deserialize(ListUserIdsResponse, resp.raw_data) async def multiple_batch_with_http_info( self, @@ -3471,9 +3441,8 @@ async def multiple_batch( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'MultipleBatchResponse' result object. """ - return ( - await self.multiple_batch_with_http_info(batch_params, request_options) - ).deserialize(MultipleBatchResponse) + resp = await self.multiple_batch_with_http_info(batch_params, request_options) + return resp.deserialize(MultipleBatchResponse, resp.raw_data) async def operation_index_with_http_info( self, @@ -3546,11 +3515,10 @@ async def operation_index( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.operation_index_with_http_info( - index_name, operation_index_params, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.operation_index_with_http_info( + index_name, operation_index_params, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def partial_update_object_with_http_info( self, @@ -3656,15 +3624,14 @@ async def partial_update_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtWithObjectIdResponse' result object. """ - return ( - await self.partial_update_object_with_http_info( - index_name, - object_id, - attributes_to_update, - create_if_not_exists, - request_options, - ) - ).deserialize(UpdatedAtWithObjectIdResponse) + resp = await self.partial_update_object_with_http_info( + index_name, + object_id, + attributes_to_update, + create_if_not_exists, + request_options, + ) + return resp.deserialize(UpdatedAtWithObjectIdResponse, resp.raw_data) async def remove_user_id_with_http_info( self, @@ -3727,9 +3694,8 @@ async def remove_user_id( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RemoveUserIdResponse' result object. """ - return ( - await self.remove_user_id_with_http_info(user_id, request_options) - ).deserialize(RemoveUserIdResponse) + resp = await self.remove_user_id_with_http_info(user_id, request_options) + return resp.deserialize(RemoveUserIdResponse, resp.raw_data) async def replace_sources_with_http_info( self, @@ -3783,9 +3749,8 @@ async def replace_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ReplaceSourceResponse' result object. """ - return ( - await self.replace_sources_with_http_info(source, request_options) - ).deserialize(ReplaceSourceResponse) + resp = await self.replace_sources_with_http_info(source, request_options) + return resp.deserialize(ReplaceSourceResponse, resp.raw_data) async def restore_api_key_with_http_info( self, @@ -3834,9 +3799,8 @@ async def restore_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AddApiKeyResponse' result object. """ - return ( - await self.restore_api_key_with_http_info(key, request_options) - ).deserialize(AddApiKeyResponse) + resp = await self.restore_api_key_with_http_info(key, request_options) + return resp.deserialize(AddApiKeyResponse, resp.raw_data) async def save_object_with_http_info( self, @@ -3917,9 +3881,8 @@ async def save_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SaveObjectResponse' result object. """ - return ( - await self.save_object_with_http_info(index_name, body, request_options) - ).deserialize(SaveObjectResponse) + resp = await self.save_object_with_http_info(index_name, body, request_options) + return resp.deserialize(SaveObjectResponse, resp.raw_data) async def save_rule_with_http_info( self, @@ -4023,11 +3986,10 @@ async def save_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedRuleResponse' result object. """ - return ( - await self.save_rule_with_http_info( - index_name, object_id, rule, forward_to_replicas, request_options - ) - ).deserialize(UpdatedRuleResponse) + resp = await self.save_rule_with_http_info( + index_name, object_id, rule, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedRuleResponse, resp.raw_data) async def save_rules_with_http_info( self, @@ -4134,15 +4096,14 @@ async def save_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.save_rules_with_http_info( - index_name, - rules, - forward_to_replicas, - clear_existing_rules, - request_options, - ) - ).deserialize(UpdatedAtResponse) + resp = await self.save_rules_with_http_info( + index_name, + rules, + forward_to_replicas, + clear_existing_rules, + request_options, + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def save_synonym_with_http_info( self, @@ -4248,11 +4209,10 @@ async def save_synonym( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SaveSynonymResponse' result object. """ - return ( - await self.save_synonym_with_http_info( - index_name, object_id, synonym_hit, forward_to_replicas, request_options - ) - ).deserialize(SaveSynonymResponse) + resp = await self.save_synonym_with_http_info( + index_name, object_id, synonym_hit, forward_to_replicas, request_options + ) + return resp.deserialize(SaveSynonymResponse, resp.raw_data) async def save_synonyms_with_http_info( self, @@ -4363,15 +4323,14 @@ async def save_synonyms( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.save_synonyms_with_http_info( - index_name, - synonym_hit, - forward_to_replicas, - replace_existing_synonyms, - request_options, - ) - ).deserialize(UpdatedAtResponse) + resp = await self.save_synonyms_with_http_info( + index_name, + synonym_hit, + forward_to_replicas, + replace_existing_synonyms, + request_options, + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def search_with_http_info( self, @@ -4435,9 +4394,8 @@ async def search( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchResponses' result object. """ - return ( - await self.search_with_http_info(search_method_params, request_options) - ).deserialize(SearchResponses) + resp = await self.search_with_http_info(search_method_params, request_options) + return resp.deserialize(SearchResponses, resp.raw_data) async def search_dictionary_entries_with_http_info( self, @@ -4508,11 +4466,10 @@ async def search_dictionary_entries( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchDictionaryEntriesResponse' result object. """ - return ( - await self.search_dictionary_entries_with_http_info( - dictionary_name, search_dictionary_entries_params, request_options - ) - ).deserialize(SearchDictionaryEntriesResponse) + resp = await self.search_dictionary_entries_with_http_info( + dictionary_name, search_dictionary_entries_params, request_options + ) + return resp.deserialize(SearchDictionaryEntriesResponse, resp.raw_data) async def search_for_facet_values_with_http_info( self, @@ -4601,11 +4558,10 @@ async def search_for_facet_values( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchForFacetValuesResponse' result object. """ - return ( - await self.search_for_facet_values_with_http_info( - index_name, facet_name, search_for_facet_values_request, request_options - ) - ).deserialize(SearchForFacetValuesResponse) + resp = await self.search_for_facet_values_with_http_info( + index_name, facet_name, search_for_facet_values_request, request_options + ) + return resp.deserialize(SearchForFacetValuesResponse, resp.raw_data) async def search_rules_with_http_info( self, @@ -4673,11 +4629,10 @@ async def search_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchRulesResponse' result object. """ - return ( - await self.search_rules_with_http_info( - index_name, search_rules_params, request_options - ) - ).deserialize(SearchRulesResponse) + resp = await self.search_rules_with_http_info( + index_name, search_rules_params, request_options + ) + return resp.deserialize(SearchRulesResponse, resp.raw_data) async def search_single_index_with_http_info( self, @@ -4745,11 +4700,10 @@ async def search_single_index( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchResponse' result object. """ - return ( - await self.search_single_index_with_http_info( - index_name, search_params, request_options - ) - ).deserialize(SearchResponse) + resp = await self.search_single_index_with_http_info( + index_name, search_params, request_options + ) + return resp.deserialize(SearchResponse, resp.raw_data) async def search_synonyms_with_http_info( self, @@ -4823,11 +4777,10 @@ async def search_synonyms( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchSynonymsResponse' result object. """ - return ( - await self.search_synonyms_with_http_info( - index_name, search_synonyms_params, request_options - ) - ).deserialize(SearchSynonymsResponse) + resp = await self.search_synonyms_with_http_info( + index_name, search_synonyms_params, request_options + ) + return resp.deserialize(SearchSynonymsResponse, resp.raw_data) async def search_user_ids_with_http_info( self, @@ -4881,11 +4834,10 @@ async def search_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchUserIdsResponse' result object. """ - return ( - await self.search_user_ids_with_http_info( - search_user_ids_params, request_options - ) - ).deserialize(SearchUserIdsResponse) + resp = await self.search_user_ids_with_http_info( + search_user_ids_params, request_options + ) + return resp.deserialize(SearchUserIdsResponse, resp.raw_data) async def set_dictionary_settings_with_http_info( self, @@ -4939,11 +4891,10 @@ async def set_dictionary_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.set_dictionary_settings_with_http_info( - dictionary_settings_params, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.set_dictionary_settings_with_http_info( + dictionary_settings_params, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def set_settings_with_http_info( self, @@ -5034,11 +4985,10 @@ async def set_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - await self.set_settings_with_http_info( - index_name, index_settings, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = await self.set_settings_with_http_info( + index_name, index_settings, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) async def update_api_key_with_http_info( self, @@ -5103,9 +5053,8 @@ async def update_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdateApiKeyResponse' result object. """ - return ( - await self.update_api_key_with_http_info(key, api_key, request_options) - ).deserialize(UpdateApiKeyResponse) + resp = await self.update_api_key_with_http_info(key, api_key, request_options) + return resp.deserialize(UpdateApiKeyResponse, resp.raw_data) class SearchClientSync: @@ -5149,9 +5098,10 @@ def __init__( transporter = TransporterSync(config) self._transporter = transporter + @classmethod def create_with_config( - config: SearchConfig, transporter: Optional[TransporterSync] = None - ) -> Self: + cls, config: SearchConfig, transporter: Optional[TransporterSync] = None + ) -> SearchClientSync: """Allows creating a client with a customized `SearchConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. Args: @@ -5213,7 +5163,7 @@ def _aggregator(_: GetTaskResponse) -> None: aggregator=_aggregator, validate=lambda _resp: _resp.status == "published", timeout=lambda: timeout(self._retry_count), - error_validate=lambda x: self._retry_count >= max_retries, + error_validate=lambda _: self._retry_count >= max_retries, error_message=lambda: f"The maximum number of retries exceeded. (${self._retry_count}/${max_retries})", ) @@ -5240,7 +5190,7 @@ def _aggregator(_: GetTaskResponse) -> None: aggregator=_aggregator, validate=lambda _resp: _resp.status == "published", timeout=lambda: timeout(self._retry_count), - error_validate=lambda x: self._retry_count >= max_retries, + error_validate=lambda _: self._retry_count >= max_retries, error_message=lambda: f"The maximum number of retries exceeded. (${self._retry_count}/${max_retries})", ) @@ -5645,9 +5595,8 @@ def add_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AddApiKeyResponse' result object. """ - return (self.add_api_key_with_http_info(api_key, request_options)).deserialize( - AddApiKeyResponse - ) + resp = self.add_api_key_with_http_info(api_key, request_options) + return resp.deserialize(AddApiKeyResponse, resp.raw_data) def add_or_update_object_with_http_info( self, @@ -5741,11 +5690,10 @@ def add_or_update_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtWithObjectIdResponse' result object. """ - return ( - self.add_or_update_object_with_http_info( - index_name, object_id, body, request_options - ) - ).deserialize(UpdatedAtWithObjectIdResponse) + resp = self.add_or_update_object_with_http_info( + index_name, object_id, body, request_options + ) + return resp.deserialize(UpdatedAtWithObjectIdResponse, resp.raw_data) def append_source_with_http_info( self, @@ -5799,9 +5747,8 @@ def append_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'CreatedAtResponse' result object. """ - return (self.append_source_with_http_info(source, request_options)).deserialize( - CreatedAtResponse - ) + resp = self.append_source_with_http_info(source, request_options) + return resp.deserialize(CreatedAtResponse, resp.raw_data) def assign_user_id_with_http_info( self, @@ -5884,11 +5831,10 @@ def assign_user_id( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'CreatedAtResponse' result object. """ - return ( - self.assign_user_id_with_http_info( - x_algolia_user_id, assign_user_id_params, request_options - ) - ).deserialize(CreatedAtResponse) + resp = self.assign_user_id_with_http_info( + x_algolia_user_id, assign_user_id_params, request_options + ) + return resp.deserialize(CreatedAtResponse, resp.raw_data) def batch_with_http_info( self, @@ -5955,9 +5901,10 @@ def batch( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BatchResponse' result object. """ - return ( - self.batch_with_http_info(index_name, batch_write_params, request_options) - ).deserialize(BatchResponse) + resp = self.batch_with_http_info( + index_name, batch_write_params, request_options + ) + return resp.deserialize(BatchResponse, resp.raw_data) def batch_assign_user_ids_with_http_info( self, @@ -6040,11 +5987,10 @@ def batch_assign_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'CreatedAtResponse' result object. """ - return ( - self.batch_assign_user_ids_with_http_info( - x_algolia_user_id, batch_assign_user_ids_params, request_options - ) - ).deserialize(CreatedAtResponse) + resp = self.batch_assign_user_ids_with_http_info( + x_algolia_user_id, batch_assign_user_ids_params, request_options + ) + return resp.deserialize(CreatedAtResponse, resp.raw_data) def batch_dictionary_entries_with_http_info( self, @@ -6115,11 +6061,10 @@ def batch_dictionary_entries( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.batch_dictionary_entries_with_http_info( - dictionary_name, batch_dictionary_entries_params, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.batch_dictionary_entries_with_http_info( + dictionary_name, batch_dictionary_entries_params, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def browse_with_http_info( self, @@ -6187,9 +6132,8 @@ def browse( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'BrowseResponse' result object. """ - return ( - self.browse_with_http_info(index_name, browse_params, request_options) - ).deserialize(BrowseResponse) + resp = self.browse_with_http_info(index_name, browse_params, request_options) + return resp.deserialize(BrowseResponse, resp.raw_data) def clear_objects_with_http_info( self, @@ -6246,9 +6190,8 @@ def clear_objects( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.clear_objects_with_http_info(index_name, request_options) - ).deserialize(UpdatedAtResponse) + resp = self.clear_objects_with_http_info(index_name, request_options) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def clear_rules_with_http_info( self, @@ -6323,11 +6266,10 @@ def clear_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.clear_rules_with_http_info( - index_name, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.clear_rules_with_http_info( + index_name, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def clear_synonyms_with_http_info( self, @@ -6402,11 +6344,10 @@ def clear_synonyms( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.clear_synonyms_with_http_info( - index_name, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.clear_synonyms_with_http_info( + index_name, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def custom_delete_with_http_info( self, @@ -6480,9 +6421,8 @@ def custom_delete( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_delete_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_get_with_http_info( self, @@ -6554,9 +6494,8 @@ def custom_get( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) + resp = self.custom_get_with_http_info(path, parameters, request_options) + return resp.deserialize(object, resp.raw_data) def custom_post_with_http_info( self, @@ -6645,9 +6584,8 @@ def custom_post( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_post_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def custom_put_with_http_info( self, @@ -6736,9 +6674,8 @@ def custom_put( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) + resp = self.custom_put_with_http_info(path, parameters, body, request_options) + return resp.deserialize(object, resp.raw_data) def delete_api_key_with_http_info( self, @@ -6787,9 +6724,8 @@ def delete_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteApiKeyResponse' result object. """ - return (self.delete_api_key_with_http_info(key, request_options)).deserialize( - DeleteApiKeyResponse - ) + resp = self.delete_api_key_with_http_info(key, request_options) + return resp.deserialize(DeleteApiKeyResponse, resp.raw_data) def delete_by_with_http_info( self, @@ -6862,9 +6798,10 @@ def delete_by( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - self.delete_by_with_http_info(index_name, delete_by_params, request_options) - ).deserialize(DeletedAtResponse) + resp = self.delete_by_with_http_info( + index_name, delete_by_params, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) def delete_index_with_http_info( self, @@ -6921,9 +6858,8 @@ def delete_index( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - self.delete_index_with_http_info(index_name, request_options) - ).deserialize(DeletedAtResponse) + resp = self.delete_index_with_http_info(index_name, request_options) + return resp.deserialize(DeletedAtResponse, resp.raw_data) def delete_object_with_http_info( self, @@ -6991,9 +6927,8 @@ def delete_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - self.delete_object_with_http_info(index_name, object_id, request_options) - ).deserialize(DeletedAtResponse) + resp = self.delete_object_with_http_info(index_name, object_id, request_options) + return resp.deserialize(DeletedAtResponse, resp.raw_data) def delete_rule_with_http_info( self, @@ -7083,11 +7018,10 @@ def delete_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.delete_rule_with_http_info( - index_name, object_id, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.delete_rule_with_http_info( + index_name, object_id, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def delete_source_with_http_info( self, @@ -7142,9 +7076,8 @@ def delete_source( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeleteSourceResponse' result object. """ - return (self.delete_source_with_http_info(source, request_options)).deserialize( - DeleteSourceResponse - ) + resp = self.delete_source_with_http_info(source, request_options) + return resp.deserialize(DeleteSourceResponse, resp.raw_data) def delete_synonym_with_http_info( self, @@ -7234,11 +7167,10 @@ def delete_synonym( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'DeletedAtResponse' result object. """ - return ( - self.delete_synonym_with_http_info( - index_name, object_id, forward_to_replicas, request_options - ) - ).deserialize(DeletedAtResponse) + resp = self.delete_synonym_with_http_info( + index_name, object_id, forward_to_replicas, request_options + ) + return resp.deserialize(DeletedAtResponse, resp.raw_data) def get_api_key_with_http_info( self, @@ -7281,9 +7213,8 @@ def get_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetApiKeyResponse' result object. """ - return (self.get_api_key_with_http_info(key, request_options)).deserialize( - GetApiKeyResponse - ) + resp = self.get_api_key_with_http_info(key, request_options) + return resp.deserialize(GetApiKeyResponse, resp.raw_data) def get_app_task_with_http_info( self, @@ -7332,9 +7263,8 @@ def get_app_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTaskResponse' result object. """ - return (self.get_app_task_with_http_info(task_id, request_options)).deserialize( - GetTaskResponse - ) + resp = self.get_app_task_with_http_info(task_id, request_options) + return resp.deserialize(GetTaskResponse, resp.raw_data) def get_dictionary_languages_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -7370,9 +7300,8 @@ def get_dictionary_languages( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Dict[str, Languages]' result object. """ - return ( - self.get_dictionary_languages_with_http_info(request_options) - ).deserialize(Dict[str, Languages]) + resp = self.get_dictionary_languages_with_http_info(request_options) + return resp.deserialize(Dict[str, Languages], resp.raw_data) def get_dictionary_settings_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -7408,9 +7337,8 @@ def get_dictionary_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetDictionarySettingsResponse' result object. """ - return ( - self.get_dictionary_settings_with_http_info(request_options) - ).deserialize(GetDictionarySettingsResponse) + resp = self.get_dictionary_settings_with_http_info(request_options) + return resp.deserialize(GetDictionarySettingsResponse, resp.raw_data) def get_logs_with_http_info( self, @@ -7520,11 +7448,10 @@ def get_logs( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetLogsResponse' result object. """ - return ( - self.get_logs_with_http_info( - offset, length, index_name, type, request_options - ) - ).deserialize(GetLogsResponse) + resp = self.get_logs_with_http_info( + offset, length, index_name, type, request_options + ) + return resp.deserialize(GetLogsResponse, resp.raw_data) def get_object_with_http_info( self, @@ -7614,11 +7541,10 @@ def get_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'object' result object. """ - return ( - self.get_object_with_http_info( - index_name, object_id, attributes_to_retrieve, request_options - ) - ).deserialize(object) + resp = self.get_object_with_http_info( + index_name, object_id, attributes_to_retrieve, request_options + ) + return resp.deserialize(object, resp.raw_data) def get_objects_with_http_info( self, @@ -7676,9 +7602,8 @@ def get_objects( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetObjectsResponse' result object. """ - return ( - self.get_objects_with_http_info(get_objects_params, request_options) - ).deserialize(GetObjectsResponse) + resp = self.get_objects_with_http_info(get_objects_params, request_options) + return resp.deserialize(GetObjectsResponse, resp.raw_data) def get_rule_with_http_info( self, @@ -7750,9 +7675,8 @@ def get_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'Rule' result object. """ - return ( - self.get_rule_with_http_info(index_name, object_id, request_options) - ).deserialize(Rule) + resp = self.get_rule_with_http_info(index_name, object_id, request_options) + return resp.deserialize(Rule, resp.raw_data) def get_settings_with_http_info( self, @@ -7809,9 +7733,8 @@ def get_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SettingsResponse' result object. """ - return ( - self.get_settings_with_http_info(index_name, request_options) - ).deserialize(SettingsResponse) + resp = self.get_settings_with_http_info(index_name, request_options) + return resp.deserialize(SettingsResponse, resp.raw_data) def get_sources_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -7847,9 +7770,8 @@ def get_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'List[Source]' result object. """ - return (self.get_sources_with_http_info(request_options)).deserialize( - List[Source] - ) + resp = self.get_sources_with_http_info(request_options) + return resp.deserialize(List[Source], resp.raw_data) def get_synonym_with_http_info( self, @@ -7921,9 +7843,8 @@ def get_synonym( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SynonymHit' result object. """ - return ( - self.get_synonym_with_http_info(index_name, object_id, request_options) - ).deserialize(SynonymHit) + resp = self.get_synonym_with_http_info(index_name, object_id, request_options) + return resp.deserialize(SynonymHit, resp.raw_data) def get_task_with_http_info( self, @@ -7989,9 +7910,8 @@ def get_task( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTaskResponse' result object. """ - return ( - self.get_task_with_http_info(index_name, task_id, request_options) - ).deserialize(GetTaskResponse) + resp = self.get_task_with_http_info(index_name, task_id, request_options) + return resp.deserialize(GetTaskResponse, resp.raw_data) def get_top_user_ids_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -8027,9 +7947,8 @@ def get_top_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'GetTopUserIdsResponse' result object. """ - return (self.get_top_user_ids_with_http_info(request_options)).deserialize( - GetTopUserIdsResponse - ) + resp = self.get_top_user_ids_with_http_info(request_options) + return resp.deserialize(GetTopUserIdsResponse, resp.raw_data) def get_user_id_with_http_info( self, @@ -8092,9 +8011,8 @@ def get_user_id( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UserId' result object. """ - return (self.get_user_id_with_http_info(user_id, request_options)).deserialize( - UserId - ) + resp = self.get_user_id_with_http_info(user_id, request_options) + return resp.deserialize(UserId, resp.raw_data) def has_pending_mappings_with_http_info( self, @@ -8154,9 +8072,8 @@ def has_pending_mappings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'HasPendingMappingsResponse' result object. """ - return ( - self.has_pending_mappings_with_http_info(get_clusters, request_options) - ).deserialize(HasPendingMappingsResponse) + resp = self.has_pending_mappings_with_http_info(get_clusters, request_options) + return resp.deserialize(HasPendingMappingsResponse, resp.raw_data) def list_api_keys_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -8192,9 +8109,8 @@ def list_api_keys( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListApiKeysResponse' result object. """ - return (self.list_api_keys_with_http_info(request_options)).deserialize( - ListApiKeysResponse - ) + resp = self.list_api_keys_with_http_info(request_options) + return resp.deserialize(ListApiKeysResponse, resp.raw_data) def list_clusters_with_http_info( self, request_options: Optional[Union[dict, RequestOptions]] = None @@ -8230,9 +8146,8 @@ def list_clusters( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListClustersResponse' result object. """ - return (self.list_clusters_with_http_info(request_options)).deserialize( - ListClustersResponse - ) + resp = self.list_clusters_with_http_info(request_options) + return resp.deserialize(ListClustersResponse, resp.raw_data) def list_indices_with_http_info( self, @@ -8304,9 +8219,8 @@ def list_indices( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListIndicesResponse' result object. """ - return ( - self.list_indices_with_http_info(page, hits_per_page, request_options) - ).deserialize(ListIndicesResponse) + resp = self.list_indices_with_http_info(page, hits_per_page, request_options) + return resp.deserialize(ListIndicesResponse, resp.raw_data) def list_user_ids_with_http_info( self, @@ -8378,9 +8292,8 @@ def list_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ListUserIdsResponse' result object. """ - return ( - self.list_user_ids_with_http_info(page, hits_per_page, request_options) - ).deserialize(ListUserIdsResponse) + resp = self.list_user_ids_with_http_info(page, hits_per_page, request_options) + return resp.deserialize(ListUserIdsResponse, resp.raw_data) def multiple_batch_with_http_info( self, @@ -8430,9 +8343,8 @@ def multiple_batch( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'MultipleBatchResponse' result object. """ - return ( - self.multiple_batch_with_http_info(batch_params, request_options) - ).deserialize(MultipleBatchResponse) + resp = self.multiple_batch_with_http_info(batch_params, request_options) + return resp.deserialize(MultipleBatchResponse, resp.raw_data) def operation_index_with_http_info( self, @@ -8505,11 +8417,10 @@ def operation_index( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.operation_index_with_http_info( - index_name, operation_index_params, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.operation_index_with_http_info( + index_name, operation_index_params, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def partial_update_object_with_http_info( self, @@ -8615,15 +8526,14 @@ def partial_update_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtWithObjectIdResponse' result object. """ - return ( - self.partial_update_object_with_http_info( - index_name, - object_id, - attributes_to_update, - create_if_not_exists, - request_options, - ) - ).deserialize(UpdatedAtWithObjectIdResponse) + resp = self.partial_update_object_with_http_info( + index_name, + object_id, + attributes_to_update, + create_if_not_exists, + request_options, + ) + return resp.deserialize(UpdatedAtWithObjectIdResponse, resp.raw_data) def remove_user_id_with_http_info( self, @@ -8686,9 +8596,8 @@ def remove_user_id( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'RemoveUserIdResponse' result object. """ - return ( - self.remove_user_id_with_http_info(user_id, request_options) - ).deserialize(RemoveUserIdResponse) + resp = self.remove_user_id_with_http_info(user_id, request_options) + return resp.deserialize(RemoveUserIdResponse, resp.raw_data) def replace_sources_with_http_info( self, @@ -8742,9 +8651,8 @@ def replace_sources( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'ReplaceSourceResponse' result object. """ - return ( - self.replace_sources_with_http_info(source, request_options) - ).deserialize(ReplaceSourceResponse) + resp = self.replace_sources_with_http_info(source, request_options) + return resp.deserialize(ReplaceSourceResponse, resp.raw_data) def restore_api_key_with_http_info( self, @@ -8793,9 +8701,8 @@ def restore_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'AddApiKeyResponse' result object. """ - return (self.restore_api_key_with_http_info(key, request_options)).deserialize( - AddApiKeyResponse - ) + resp = self.restore_api_key_with_http_info(key, request_options) + return resp.deserialize(AddApiKeyResponse, resp.raw_data) def save_object_with_http_info( self, @@ -8876,9 +8783,8 @@ def save_object( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SaveObjectResponse' result object. """ - return ( - self.save_object_with_http_info(index_name, body, request_options) - ).deserialize(SaveObjectResponse) + resp = self.save_object_with_http_info(index_name, body, request_options) + return resp.deserialize(SaveObjectResponse, resp.raw_data) def save_rule_with_http_info( self, @@ -8982,11 +8888,10 @@ def save_rule( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedRuleResponse' result object. """ - return ( - self.save_rule_with_http_info( - index_name, object_id, rule, forward_to_replicas, request_options - ) - ).deserialize(UpdatedRuleResponse) + resp = self.save_rule_with_http_info( + index_name, object_id, rule, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedRuleResponse, resp.raw_data) def save_rules_with_http_info( self, @@ -9093,15 +8998,14 @@ def save_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.save_rules_with_http_info( - index_name, - rules, - forward_to_replicas, - clear_existing_rules, - request_options, - ) - ).deserialize(UpdatedAtResponse) + resp = self.save_rules_with_http_info( + index_name, + rules, + forward_to_replicas, + clear_existing_rules, + request_options, + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def save_synonym_with_http_info( self, @@ -9207,11 +9111,10 @@ def save_synonym( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SaveSynonymResponse' result object. """ - return ( - self.save_synonym_with_http_info( - index_name, object_id, synonym_hit, forward_to_replicas, request_options - ) - ).deserialize(SaveSynonymResponse) + resp = self.save_synonym_with_http_info( + index_name, object_id, synonym_hit, forward_to_replicas, request_options + ) + return resp.deserialize(SaveSynonymResponse, resp.raw_data) def save_synonyms_with_http_info( self, @@ -9322,15 +9225,14 @@ def save_synonyms( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.save_synonyms_with_http_info( - index_name, - synonym_hit, - forward_to_replicas, - replace_existing_synonyms, - request_options, - ) - ).deserialize(UpdatedAtResponse) + resp = self.save_synonyms_with_http_info( + index_name, + synonym_hit, + forward_to_replicas, + replace_existing_synonyms, + request_options, + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def search_with_http_info( self, @@ -9394,9 +9296,8 @@ def search( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchResponses' result object. """ - return ( - self.search_with_http_info(search_method_params, request_options) - ).deserialize(SearchResponses) + resp = self.search_with_http_info(search_method_params, request_options) + return resp.deserialize(SearchResponses, resp.raw_data) def search_dictionary_entries_with_http_info( self, @@ -9467,11 +9368,10 @@ def search_dictionary_entries( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchDictionaryEntriesResponse' result object. """ - return ( - self.search_dictionary_entries_with_http_info( - dictionary_name, search_dictionary_entries_params, request_options - ) - ).deserialize(SearchDictionaryEntriesResponse) + resp = self.search_dictionary_entries_with_http_info( + dictionary_name, search_dictionary_entries_params, request_options + ) + return resp.deserialize(SearchDictionaryEntriesResponse, resp.raw_data) def search_for_facet_values_with_http_info( self, @@ -9560,11 +9460,10 @@ def search_for_facet_values( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchForFacetValuesResponse' result object. """ - return ( - self.search_for_facet_values_with_http_info( - index_name, facet_name, search_for_facet_values_request, request_options - ) - ).deserialize(SearchForFacetValuesResponse) + resp = self.search_for_facet_values_with_http_info( + index_name, facet_name, search_for_facet_values_request, request_options + ) + return resp.deserialize(SearchForFacetValuesResponse, resp.raw_data) def search_rules_with_http_info( self, @@ -9632,11 +9531,10 @@ def search_rules( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchRulesResponse' result object. """ - return ( - self.search_rules_with_http_info( - index_name, search_rules_params, request_options - ) - ).deserialize(SearchRulesResponse) + resp = self.search_rules_with_http_info( + index_name, search_rules_params, request_options + ) + return resp.deserialize(SearchRulesResponse, resp.raw_data) def search_single_index_with_http_info( self, @@ -9704,11 +9602,10 @@ def search_single_index( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchResponse' result object. """ - return ( - self.search_single_index_with_http_info( - index_name, search_params, request_options - ) - ).deserialize(SearchResponse) + resp = self.search_single_index_with_http_info( + index_name, search_params, request_options + ) + return resp.deserialize(SearchResponse, resp.raw_data) def search_synonyms_with_http_info( self, @@ -9782,11 +9679,10 @@ def search_synonyms( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchSynonymsResponse' result object. """ - return ( - self.search_synonyms_with_http_info( - index_name, search_synonyms_params, request_options - ) - ).deserialize(SearchSynonymsResponse) + resp = self.search_synonyms_with_http_info( + index_name, search_synonyms_params, request_options + ) + return resp.deserialize(SearchSynonymsResponse, resp.raw_data) def search_user_ids_with_http_info( self, @@ -9840,9 +9736,10 @@ def search_user_ids( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'SearchUserIdsResponse' result object. """ - return ( - self.search_user_ids_with_http_info(search_user_ids_params, request_options) - ).deserialize(SearchUserIdsResponse) + resp = self.search_user_ids_with_http_info( + search_user_ids_params, request_options + ) + return resp.deserialize(SearchUserIdsResponse, resp.raw_data) def set_dictionary_settings_with_http_info( self, @@ -9896,11 +9793,10 @@ def set_dictionary_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.set_dictionary_settings_with_http_info( - dictionary_settings_params, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.set_dictionary_settings_with_http_info( + dictionary_settings_params, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def set_settings_with_http_info( self, @@ -9991,11 +9887,10 @@ def set_settings( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdatedAtResponse' result object. """ - return ( - self.set_settings_with_http_info( - index_name, index_settings, forward_to_replicas, request_options - ) - ).deserialize(UpdatedAtResponse) + resp = self.set_settings_with_http_info( + index_name, index_settings, forward_to_replicas, request_options + ) + return resp.deserialize(UpdatedAtResponse, resp.raw_data) def update_api_key_with_http_info( self, @@ -10060,6 +9955,5 @@ def update_api_key( :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) :return: Returns the deserialized response in a 'UpdateApiKeyResponse' result object. """ - return ( - self.update_api_key_with_http_info(key, api_key, request_options) - ).deserialize(UpdateApiKeyResponse) + resp = self.update_api_key_with_http_info(key, api_key, request_options) + return resp.deserialize(UpdateApiKeyResponse, resp.raw_data) diff --git a/poetry.lock b/poetry.lock index f2cf5d7a0..d7aef8ea4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -830,5 +830,5 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" -python-versions = "^3.8.1" -content-hash = "7815869d7f760ab20d613ecc1f327a29676e5bddb41f100e5f1263b11e5d8faa" +python-versions = ">= 3.8.1" +content-hash = "fb564ceafa860bc38c52945bf51504c4d7a6eb09f5a9cd65acd1aeafde93c22a" diff --git a/pyproject.toml b/pyproject.toml index 2e5429ed7..1d881f0ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.8.1" +python = ">= 3.8.1" urllib3 = ">= 1.25.3" aiohttp = ">= 3.9.2" requests = ">=2.32.3"