Skip to content

Commit 74d9811

Browse files
feat(clients): add replaceAllObjectsWithTransformation (generated)
algolia/api-clients-automation#5013 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 85f002e commit 74d9811

File tree

21 files changed

+300
-40
lines changed

21 files changed

+300
-40
lines changed

algoliasearch/abtesting/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ def __init__(
7676
elif config is None:
7777
config = AbtestingConfig(app_id, api_key, region)
7878

79+
config.set_default_hosts()
80+
7981
self._config = config
8082
self._request_options = RequestOptions(config)
8183

@@ -912,6 +914,8 @@ def __init__(
912914
elif config is None:
913915
config = AbtestingConfig(app_id, api_key, region)
914916

917+
config.set_default_hosts()
918+
915919
self._config = config
916920
self._request_options = RequestOptions(config)
917921

algoliasearch/abtesting/config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ def __init__(
4848
self.proxies["https"] = https_proxy
4949

5050
self.region = region
51+
52+
def set_default_hosts(self):
53+
if self.hosts is not None:
54+
return
55+
5156
_regions = ["de", "us"]
5257

53-
if region is not None and region not in _regions:
58+
if self.region is not None and self.region not in _regions:
5459
raise ValueError(
5560
f"`region` must be one of the following: {', '.join(_regions)}"
5661
)
@@ -59,9 +64,9 @@ def __init__(
5964
[
6065
Host(
6166
"analytics.algolia.com"
62-
if region is None
67+
if self.region is None
6368
else "analytics.{region}.algolia.com".replace(
64-
"{region}", region or ""
69+
"{region}", self.region or ""
6570
)
6671
)
6772
]

algoliasearch/analytics/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def __init__(
9090
elif config is None:
9191
config = AnalyticsConfig(app_id, api_key, region)
9292

93+
config.set_default_hosts()
94+
9395
self._config = config
9496
self._request_options = RequestOptions(config)
9597

@@ -3116,6 +3118,8 @@ def __init__(
31163118
elif config is None:
31173119
config = AnalyticsConfig(app_id, api_key, region)
31183120

3121+
config.set_default_hosts()
3122+
31193123
self._config = config
31203124
self._request_options = RequestOptions(config)
31213125

algoliasearch/analytics/config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ def __init__(
4848
self.proxies["https"] = https_proxy
4949

5050
self.region = region
51+
52+
def set_default_hosts(self):
53+
if self.hosts is not None:
54+
return
55+
5156
_regions = ["de", "us"]
5257

53-
if region is not None and region not in _regions:
58+
if self.region is not None and self.region not in _regions:
5459
raise ValueError(
5560
f"`region` must be one of the following: {', '.join(_regions)}"
5661
)
@@ -59,9 +64,9 @@ def __init__(
5964
[
6065
Host(
6166
"analytics.algolia.com"
62-
if region is None
67+
if self.region is None
6368
else "analytics.{region}.algolia.com".replace(
64-
"{region}", region or ""
69+
"{region}", self.region or ""
6570
)
6671
)
6772
]

algoliasearch/composition/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def __init__(
7171
elif config is None:
7272
config = CompositionConfig(app_id, api_key)
7373

74+
config.set_default_hosts()
75+
7476
self._config = config
7577
self._request_options = RequestOptions(config)
7678

@@ -331,6 +333,8 @@ def __init__(
331333
elif config is None:
332334
config = CompositionConfig(app_id, api_key)
333335

336+
config.set_default_hosts()
337+
334338
self._config = config
335339
self._request_options = RequestOptions(config)
336340

algoliasearch/composition/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def __init__(self, app_id: Optional[str], api_key: Optional[str]) -> None:
4242
if https_proxy is not None:
4343
self.proxies["https"] = https_proxy
4444

45+
def set_default_hosts(self):
46+
if self.hosts is not None:
47+
return
48+
4549
self.hosts = HostsCollection(
4650
[
4751
Host(

algoliasearch/ingestion/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def __init__(
145145
elif config is None:
146146
config = IngestionConfig(app_id, api_key, region)
147147

148+
config.set_default_hosts()
149+
148150
self._config = config
149151
self._request_options = RequestOptions(config)
150152

@@ -230,6 +232,7 @@ async def chunked_push(
230232
request_options=request_options,
231233
)
232234
)
235+
records = []
233236
if wait_for_tasks:
234237
for response in responses:
235238

@@ -5226,6 +5229,8 @@ def __init__(
52265229
elif config is None:
52275230
config = IngestionConfig(app_id, api_key, region)
52285231

5232+
config.set_default_hosts()
5233+
52295234
self._config = config
52305235
self._request_options = RequestOptions(config)
52315236

@@ -5310,6 +5315,7 @@ def chunked_push(
53105315
request_options=request_options,
53115316
)
53125317
)
5318+
records = []
53135319
if wait_for_tasks:
53145320
for response in responses:
53155321

algoliasearch/ingestion/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@ def __init__(
4545
self.proxies["https"] = https_proxy
4646

4747
self.region = region
48+
49+
def set_default_hosts(self):
50+
if self.hosts is not None:
51+
return
52+
4853
_regions = ["eu", "us"]
4954

50-
if not region or (region is not None and region not in _regions):
55+
if not self.region or (self.region is not None and self.region not in _regions):
5156
raise ValueError(
5257
f"`region` is required and must be one of the following: {', '.join(_regions)}"
5358
)
5459

5560
self.hosts = HostsCollection(
56-
[Host("data.{region}.algolia.com".replace("{region}", region or ""))]
61+
[Host("data.{region}.algolia.com".replace("{region}", self.region or ""))]
5762
)

algoliasearch/insights/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def __init__(
6767
elif config is None:
6868
config = InsightsConfig(app_id, api_key, region)
6969

70+
config.set_default_hosts()
71+
7072
self._config = config
7173
self._request_options = RequestOptions(config)
7274

@@ -601,6 +603,8 @@ def __init__(
601603
elif config is None:
602604
config = InsightsConfig(app_id, api_key, region)
603605

606+
config.set_default_hosts()
607+
604608
self._config = config
605609
self._request_options = RequestOptions(config)
606610

algoliasearch/insights/config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ def __init__(
4848
self.proxies["https"] = https_proxy
4949

5050
self.region = region
51+
52+
def set_default_hosts(self):
53+
if self.hosts is not None:
54+
return
55+
5156
_regions = ["de", "us"]
5257

53-
if region is not None and region not in _regions:
58+
if self.region is not None and self.region not in _regions:
5459
raise ValueError(
5560
f"`region` must be one of the following: {', '.join(_regions)}"
5661
)
@@ -59,9 +64,9 @@ def __init__(
5964
[
6065
Host(
6166
"insights.algolia.io"
62-
if region is None
67+
if self.region is None
6368
else "insights.{region}.algolia.io".replace(
64-
"{region}", region or ""
69+
"{region}", self.region or ""
6570
)
6671
)
6772
]

0 commit comments

Comments
 (0)