55from typing import TYPE_CHECKING , Any
66
77import jwt
8+ from camel_converter import dict_to_camel
89from httpx import AsyncClient as HttpxAsyncClient
910from httpx import Client as HttpxClient
1011
@@ -1189,7 +1190,7 @@ async def wait_for_task(
11891190 >>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
11901191 >>> {"id": 2, "title": "Movie 2", "genre": "drama"},
11911192 >>> ]
1192- >>> async with Client ("http://localhost.com", "masterKey") as client:
1193+ >>> async with AsyncClient ("http://localhost.com", "masterKey") as client:
11931194 >>> index = client.index("movies")
11941195 >>> response = await index.add_documents(documents)
11951196 >>> await client.wait_for_task(client, response.update_id)
@@ -1232,7 +1233,7 @@ async def transfer_documents( # pragma: no cover
12321233
12331234 Examples
12341235 >>> from meilisearch_python_sdk import AsyncClient
1235- >>> async with Client ("http://localhost.com", "masterKey") as client:
1236+ >>> async with AsyncClient ("http://localhost.com", "masterKey") as client:
12361237 >>> await index.transfer_documents(
12371238 >>> "https://another-instance.com", api_key="otherMasterKey"
12381239 >>> )
@@ -1252,6 +1253,52 @@ async def transfer_documents( # pragma: no cover
12521253
12531254 return TaskInfo (** response .json ())
12541255
1256+ async def get_experimental_features (self ) -> dict [str , bool ]:
1257+ """Gets all experimental features and if they are enabled or not.
1258+
1259+ Returns:
1260+ The status of the experimental features.
1261+
1262+ Raises:
1263+ MeilisearchCommunicationError: If there was an error communicating with the server.
1264+ MeilisearchApiError: If the Meilisearch API returned an error.
1265+ MeilisearchTimeoutError: If the connection times out.
1266+
1267+ Examples
1268+ >>> from meilisearch_python_sdk import AsyncClient
1269+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
1270+ >>> await index.get_experimental_feature()
1271+ """
1272+
1273+ response = await self ._http_requests .get ("/experimental-features" )
1274+ return response .json ()
1275+
1276+ async def update_experimental_features (self , features : dict [str , bool ]) -> dict [str , bool ]:
1277+ """Update the status of an experimental feature.
1278+
1279+ Args:
1280+ features: Dictionary of features to enable/disable. The dictionary keys can be in either
1281+ camel case or snake case, the conversion to the correct type will be handed for you by
1282+ the program. For example {"logsRoute": True} and {"logs_route": True} will both work.
1283+
1284+ Returns:
1285+ The status of the experimental features.
1286+
1287+ Raises:
1288+ MeilisearchCommunicationError: If there was an error communicating with the server.
1289+ MeilisearchApiError: If the Meilisearch API returned an error.
1290+ MeilisearchTimeoutError: If the connection times out.
1291+
1292+ Examples
1293+ >>> from meilisearch_python_sdk import AsyncClient
1294+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
1295+ >>> await index.update_experimental_features({"logsRoute": True})
1296+ """
1297+ payload = dict_to_camel (features )
1298+ response = await self ._http_requests .patch ("/experimental-features" , body = payload )
1299+
1300+ return response .json ()
1301+
12551302
12561303class Client (BaseClient ):
12571304 """client to connect to the Meilisearch API."""
@@ -2351,6 +2398,52 @@ def transfer_documents( # pragma: no cover
23512398
23522399 return TaskInfo (** response .json ())
23532400
2401+ def get_experimental_features (self ) -> dict [str , bool ]:
2402+ """Gets all experimental features and if they are enabled or not.
2403+
2404+ Returns:
2405+ The status of the experimental features.
2406+
2407+ Raises:
2408+ MeilisearchCommunicationError: If there was an error communicating with the server.
2409+ MeilisearchApiError: If the Meilisearch API returned an error.
2410+ MeilisearchTimeoutError: If the connection times out.
2411+
2412+ Examples
2413+ >>> from meilisearch_python_sdk import Client
2414+ >>> with Client("http://localhost.com", "masterKey") as client:
2415+ >>> index.get_experimental_feature()
2416+ """
2417+
2418+ response = self ._http_requests .get ("/experimental-features" )
2419+ return response .json ()
2420+
2421+ def update_experimental_features (self , features : dict [str , bool ]) -> dict [str , bool ]:
2422+ """Update the status of an experimental feature.
2423+
2424+ Args:
2425+ features: Dictionary of features to enable/disable. The dictionary keys can be in either
2426+ camel case or snake case, the conversion to the correct type will be handed for you by
2427+ the program. For example {"logsRoute": True} and {"logs_route": True} will both work.
2428+
2429+ Returns:
2430+ The status of the experimental features.
2431+
2432+ Raises:
2433+ MeilisearchCommunicationError: If there was an error communicating with the server.
2434+ MeilisearchApiError: If the Meilisearch API returned an error.
2435+ MeilisearchTimeoutError: If the connection times out.
2436+
2437+ Examples
2438+ >>> from meilisearch_python_sdk import Client
2439+ >>> with Client("http://localhost.com", "masterKey") as client:
2440+ >>> index.update_experimental_features({"logsRoute": True})
2441+ """
2442+ payload = dict_to_camel (features )
2443+ response = self ._http_requests .patch ("/experimental-features" , body = payload )
2444+
2445+ return response .json ()
2446+
23542447
23552448def _build_offset_limit_url (base : str , offset : int | None , limit : int | None ) -> str :
23562449 if offset is not None and limit is not None :
0 commit comments