Skip to content

Commit 1e7319d

Browse files
Update clients/algoliasearch-client-python/algoliasearch/http/transporter.py (generated)
Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 8e70f57 commit 1e7319d

File tree

15 files changed

+1470
-1846
lines changed

15 files changed

+1470
-1846
lines changed

clients/algoliasearch-client-python/algoliasearch/abtesting/client.py

Lines changed: 63 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ def __init__(
7979
transporter = Transporter(config)
8080
self._transporter = transporter
8181

82+
@classmethod
8283
def create_with_config(
83-
config: AbtestingConfig, transporter: Optional[Transporter] = None
84-
) -> Self:
84+
cls, config: AbtestingConfig, transporter: Optional[Transporter] = None
85+
) -> AbtestingClient:
8586
"""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`.
8687
8788
Args:
@@ -106,7 +107,7 @@ def create_with_config(
106107
config=config,
107108
)
108109

109-
async def __aenter__(self) -> None:
110+
async def __aenter__(self) -> Self:
110111
return self
111112

112113
async def __aexit__(self, exc_type, exc_value, traceback) -> None:
@@ -173,11 +174,10 @@ async def add_ab_tests(
173174
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
174175
:return: Returns the deserialized response in a 'ABTestResponse' result object.
175176
"""
176-
return (
177-
await self.add_ab_tests_with_http_info(
178-
add_ab_tests_request, request_options
179-
)
180-
).deserialize(ABTestResponse)
177+
resp = await self.add_ab_tests_with_http_info(
178+
add_ab_tests_request, request_options
179+
)
180+
return resp.deserialize(ABTestResponse, resp.raw_data)
181181

182182
async def custom_delete_with_http_info(
183183
self,
@@ -251,9 +251,10 @@ async def custom_delete(
251251
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
252252
:return: Returns the deserialized response in a 'object' result object.
253253
"""
254-
return (
255-
await self.custom_delete_with_http_info(path, parameters, request_options)
256-
).deserialize(object)
254+
resp = await self.custom_delete_with_http_info(
255+
path, parameters, request_options
256+
)
257+
return resp.deserialize(object, resp.raw_data)
257258

258259
async def custom_get_with_http_info(
259260
self,
@@ -325,9 +326,8 @@ async def custom_get(
325326
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
326327
:return: Returns the deserialized response in a 'object' result object.
327328
"""
328-
return (
329-
await self.custom_get_with_http_info(path, parameters, request_options)
330-
).deserialize(object)
329+
resp = await self.custom_get_with_http_info(path, parameters, request_options)
330+
return resp.deserialize(object, resp.raw_data)
331331

332332
async def custom_post_with_http_info(
333333
self,
@@ -416,11 +416,10 @@ async def custom_post(
416416
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
417417
:return: Returns the deserialized response in a 'object' result object.
418418
"""
419-
return (
420-
await self.custom_post_with_http_info(
421-
path, parameters, body, request_options
422-
)
423-
).deserialize(object)
419+
resp = await self.custom_post_with_http_info(
420+
path, parameters, body, request_options
421+
)
422+
return resp.deserialize(object, resp.raw_data)
424423

425424
async def custom_put_with_http_info(
426425
self,
@@ -509,11 +508,10 @@ async def custom_put(
509508
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
510509
:return: Returns the deserialized response in a 'object' result object.
511510
"""
512-
return (
513-
await self.custom_put_with_http_info(
514-
path, parameters, body, request_options
515-
)
516-
).deserialize(object)
511+
resp = await self.custom_put_with_http_info(
512+
path, parameters, body, request_options
513+
)
514+
return resp.deserialize(object, resp.raw_data)
517515

518516
async def delete_ab_test_with_http_info(
519517
self,
@@ -562,9 +560,8 @@ async def delete_ab_test(
562560
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
563561
:return: Returns the deserialized response in a 'ABTestResponse' result object.
564562
"""
565-
return (
566-
await self.delete_ab_test_with_http_info(id, request_options)
567-
).deserialize(ABTestResponse)
563+
resp = await self.delete_ab_test_with_http_info(id, request_options)
564+
return resp.deserialize(ABTestResponse, resp.raw_data)
568565

569566
async def get_ab_test_with_http_info(
570567
self,
@@ -611,9 +608,8 @@ async def get_ab_test(
611608
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
612609
:return: Returns the deserialized response in a 'ABTest' result object.
613610
"""
614-
return (await self.get_ab_test_with_http_info(id, request_options)).deserialize(
615-
ABTest
616-
)
611+
resp = await self.get_ab_test_with_http_info(id, request_options)
612+
return resp.deserialize(ABTest, resp.raw_data)
617613

618614
async def list_ab_tests_with_http_info(
619615
self,
@@ -717,11 +713,10 @@ async def list_ab_tests(
717713
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
718714
:return: Returns the deserialized response in a 'ListABTestsResponse' result object.
719715
"""
720-
return (
721-
await self.list_ab_tests_with_http_info(
722-
offset, limit, index_prefix, index_suffix, request_options
723-
)
724-
).deserialize(ListABTestsResponse)
716+
resp = await self.list_ab_tests_with_http_info(
717+
offset, limit, index_prefix, index_suffix, request_options
718+
)
719+
return resp.deserialize(ListABTestsResponse, resp.raw_data)
725720

726721
async def schedule_ab_test_with_http_info(
727722
self,
@@ -775,11 +770,10 @@ async def schedule_ab_test(
775770
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
776771
:return: Returns the deserialized response in a 'ScheduleABTestResponse' result object.
777772
"""
778-
return (
779-
await self.schedule_ab_test_with_http_info(
780-
schedule_ab_tests_request, request_options
781-
)
782-
).deserialize(ScheduleABTestResponse)
773+
resp = await self.schedule_ab_test_with_http_info(
774+
schedule_ab_tests_request, request_options
775+
)
776+
return resp.deserialize(ScheduleABTestResponse, resp.raw_data)
783777

784778
async def stop_ab_test_with_http_info(
785779
self,
@@ -826,9 +820,8 @@ async def stop_ab_test(
826820
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
827821
:return: Returns the deserialized response in a 'ABTestResponse' result object.
828822
"""
829-
return (
830-
await self.stop_ab_test_with_http_info(id, request_options)
831-
).deserialize(ABTestResponse)
823+
resp = await self.stop_ab_test_with_http_info(id, request_options)
824+
return resp.deserialize(ABTestResponse, resp.raw_data)
832825

833826

834827
class AbtestingClientSync:
@@ -873,9 +866,10 @@ def __init__(
873866
transporter = TransporterSync(config)
874867
self._transporter = transporter
875868

869+
@classmethod
876870
def create_with_config(
877-
config: AbtestingConfig, transporter: Optional[TransporterSync] = None
878-
) -> Self:
871+
cls, config: AbtestingConfig, transporter: Optional[TransporterSync] = None
872+
) -> AbtestingClientSync:
879873
"""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`.
880874
881875
Args:
@@ -966,9 +960,8 @@ def add_ab_tests(
966960
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
967961
:return: Returns the deserialized response in a 'ABTestResponse' result object.
968962
"""
969-
return (
970-
self.add_ab_tests_with_http_info(add_ab_tests_request, request_options)
971-
).deserialize(ABTestResponse)
963+
resp = self.add_ab_tests_with_http_info(add_ab_tests_request, request_options)
964+
return resp.deserialize(ABTestResponse, resp.raw_data)
972965

973966
def custom_delete_with_http_info(
974967
self,
@@ -1042,9 +1035,8 @@ def custom_delete(
10421035
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
10431036
:return: Returns the deserialized response in a 'object' result object.
10441037
"""
1045-
return (
1046-
self.custom_delete_with_http_info(path, parameters, request_options)
1047-
).deserialize(object)
1038+
resp = self.custom_delete_with_http_info(path, parameters, request_options)
1039+
return resp.deserialize(object, resp.raw_data)
10481040

10491041
def custom_get_with_http_info(
10501042
self,
@@ -1116,9 +1108,8 @@ def custom_get(
11161108
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
11171109
:return: Returns the deserialized response in a 'object' result object.
11181110
"""
1119-
return (
1120-
self.custom_get_with_http_info(path, parameters, request_options)
1121-
).deserialize(object)
1111+
resp = self.custom_get_with_http_info(path, parameters, request_options)
1112+
return resp.deserialize(object, resp.raw_data)
11221113

11231114
def custom_post_with_http_info(
11241115
self,
@@ -1207,9 +1198,8 @@ def custom_post(
12071198
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
12081199
:return: Returns the deserialized response in a 'object' result object.
12091200
"""
1210-
return (
1211-
self.custom_post_with_http_info(path, parameters, body, request_options)
1212-
).deserialize(object)
1201+
resp = self.custom_post_with_http_info(path, parameters, body, request_options)
1202+
return resp.deserialize(object, resp.raw_data)
12131203

12141204
def custom_put_with_http_info(
12151205
self,
@@ -1298,9 +1288,8 @@ def custom_put(
12981288
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
12991289
:return: Returns the deserialized response in a 'object' result object.
13001290
"""
1301-
return (
1302-
self.custom_put_with_http_info(path, parameters, body, request_options)
1303-
).deserialize(object)
1291+
resp = self.custom_put_with_http_info(path, parameters, body, request_options)
1292+
return resp.deserialize(object, resp.raw_data)
13041293

13051294
def delete_ab_test_with_http_info(
13061295
self,
@@ -1349,9 +1338,8 @@ def delete_ab_test(
13491338
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
13501339
:return: Returns the deserialized response in a 'ABTestResponse' result object.
13511340
"""
1352-
return (self.delete_ab_test_with_http_info(id, request_options)).deserialize(
1353-
ABTestResponse
1354-
)
1341+
resp = self.delete_ab_test_with_http_info(id, request_options)
1342+
return resp.deserialize(ABTestResponse, resp.raw_data)
13551343

13561344
def get_ab_test_with_http_info(
13571345
self,
@@ -1398,9 +1386,8 @@ def get_ab_test(
13981386
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
13991387
:return: Returns the deserialized response in a 'ABTest' result object.
14001388
"""
1401-
return (self.get_ab_test_with_http_info(id, request_options)).deserialize(
1402-
ABTest
1403-
)
1389+
resp = self.get_ab_test_with_http_info(id, request_options)
1390+
return resp.deserialize(ABTest, resp.raw_data)
14041391

14051392
def list_ab_tests_with_http_info(
14061393
self,
@@ -1504,11 +1491,10 @@ def list_ab_tests(
15041491
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
15051492
:return: Returns the deserialized response in a 'ListABTestsResponse' result object.
15061493
"""
1507-
return (
1508-
self.list_ab_tests_with_http_info(
1509-
offset, limit, index_prefix, index_suffix, request_options
1510-
)
1511-
).deserialize(ListABTestsResponse)
1494+
resp = self.list_ab_tests_with_http_info(
1495+
offset, limit, index_prefix, index_suffix, request_options
1496+
)
1497+
return resp.deserialize(ListABTestsResponse, resp.raw_data)
15121498

15131499
def schedule_ab_test_with_http_info(
15141500
self,
@@ -1562,11 +1548,10 @@ def schedule_ab_test(
15621548
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
15631549
:return: Returns the deserialized response in a 'ScheduleABTestResponse' result object.
15641550
"""
1565-
return (
1566-
self.schedule_ab_test_with_http_info(
1567-
schedule_ab_tests_request, request_options
1568-
)
1569-
).deserialize(ScheduleABTestResponse)
1551+
resp = self.schedule_ab_test_with_http_info(
1552+
schedule_ab_tests_request, request_options
1553+
)
1554+
return resp.deserialize(ScheduleABTestResponse, resp.raw_data)
15701555

15711556
def stop_ab_test_with_http_info(
15721557
self,
@@ -1613,6 +1598,5 @@ def stop_ab_test(
16131598
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
16141599
:return: Returns the deserialized response in a 'ABTestResponse' result object.
16151600
"""
1616-
return (self.stop_ab_test_with_http_info(id, request_options)).deserialize(
1617-
ABTestResponse
1618-
)
1601+
resp = self.stop_ab_test_with_http_info(id, request_options)
1602+
return resp.deserialize(ABTestResponse, resp.raw_data)

0 commit comments

Comments
 (0)