Skip to content

Commit

Permalink
fix(python): missing transporter close (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3741

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
  • Loading branch information
algolia-bot and shortcuts committed Sep 16, 2024
1 parent e5998d8 commit 400e10b
Show file tree
Hide file tree
Showing 16 changed files with 1,495 additions and 1,864 deletions.
142 changes: 63 additions & 79 deletions algoliasearch/abtesting/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Loading

0 comments on commit 400e10b

Please sign in to comment.