meilisearch-python-sdk 4.10.1__py3-none-any.whl → 5.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of meilisearch-python-sdk might be problematic. Click here for more details.

@@ -36,6 +36,7 @@ from meilisearch_python_sdk.models.search import (
36
36
  from meilisearch_python_sdk.models.settings import MeilisearchSettings
37
37
  from meilisearch_python_sdk.models.task import TaskInfo, TaskResult, TaskStatus
38
38
  from meilisearch_python_sdk.models.version import Version
39
+ from meilisearch_python_sdk.models.webhook import Webhook, WebhookCreate, Webhooks, WebhookUpdate
39
40
  from meilisearch_python_sdk.plugins import AsyncIndexPlugins, IndexPlugins
40
41
  from meilisearch_python_sdk.types import JsonDict
41
42
 
@@ -252,6 +253,124 @@ class AsyncClient(BaseClient):
252
253
 
253
254
  return Network(**response.json())
254
255
 
256
+ async def get_webhooks(self) -> Webhooks:
257
+ """Get all webhooks.
258
+
259
+ Returns:
260
+ An instance of Webhooks containing all configured webhooks.
261
+
262
+ Raises:
263
+ MeilisearchCommunicationError: If there was an error communicating with the server.
264
+ MeilisearchApiError: If the Meilisearch API returned an error.
265
+
266
+ Examples:
267
+ >>> from meilisearch_python_sdk import AsyncClient
268
+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
269
+ >>> webhooks = await client.get_webhooks()
270
+ """
271
+ response = await self._http_requests.get("webhooks")
272
+
273
+ return Webhooks(**response.json())
274
+
275
+ async def get_webhook(self, uuid: str) -> Webhook:
276
+ """Get a specific webhook by UUID.
277
+
278
+ Args:
279
+ uuid: The webhook's unique identifier.
280
+
281
+ Returns:
282
+ An instance of Webhook containing the webhook information.
283
+
284
+ Raises:
285
+ MeilisearchCommunicationError: If there was an error communicating with the server.
286
+ MeilisearchApiError: If the Meilisearch API returned an error.
287
+
288
+ Examples:
289
+ >>> from meilisearch_python_sdk import AsyncClient
290
+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
291
+ >>> webhook = await client.get_webhook("abc-123")
292
+ """
293
+ response = await self._http_requests.get(f"webhooks/{uuid}")
294
+
295
+ return Webhook(**response.json())
296
+
297
+ async def create_webhook(self, webhook: WebhookCreate) -> Webhook:
298
+ """Create a new webhook.
299
+
300
+ Args:
301
+ webhook: The webhook configuration to create.
302
+
303
+ Returns:
304
+ The created webhook.
305
+
306
+ Raises:
307
+ MeilisearchCommunicationError: If there was an error communicating with the server.
308
+ MeilisearchApiError: If the Meilisearch API returned an error.
309
+
310
+ Examples:
311
+ >>> from meilisearch_python_sdk import AsyncClient
312
+ >>> from meilisearch_python_sdk.models.webhook import WebhookCreate
313
+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
314
+ >>> webhook_config = WebhookCreate(
315
+ >>> url="https://example.com/webhook",
316
+ >>> headers={"Authorization": "Bearer token"}
317
+ >>> )
318
+ >>> webhook = await client.create_webhook(webhook_config)
319
+ """
320
+ response = await self._http_requests.post(
321
+ "webhooks", webhook.model_dump(by_alias=True, exclude_none=True)
322
+ )
323
+
324
+ return Webhook(**response.json())
325
+
326
+ async def update_webhook(self, *, uuid: str, webhook: WebhookUpdate) -> Webhook:
327
+ """Update an existing webhook.
328
+
329
+ Args:
330
+ uuid: The webhook's unique identifier.
331
+ webhook: The webhook configuration updates.
332
+
333
+ Returns:
334
+ The updated webhook.
335
+
336
+ Raises:
337
+ MeilisearchCommunicationError: If there was an error communicating with the server.
338
+ MeilisearchApiError: If the Meilisearch API returned an error.
339
+
340
+ Examples:
341
+ >>> from meilisearch_python_sdk import AsyncClient
342
+ >>> from meilisearch_python_sdk.models.webhook import WebhookUpdate
343
+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
344
+ >>> webhook_update = WebhookUpdate(url="https://example.com/new-webhook")
345
+ >>> webhook = await client.update_webhook("abc-123", webhook_update)
346
+ """
347
+ response = await self._http_requests.patch(
348
+ f"webhooks/{uuid}", webhook.model_dump(by_alias=True, exclude_none=True)
349
+ )
350
+
351
+ return Webhook(**response.json())
352
+
353
+ async def delete_webhook(self, uuid: str) -> int:
354
+ """Delete a webhook.
355
+
356
+ Args:
357
+ uuid: The webhook's unique identifier.
358
+
359
+ Returns:
360
+ The Response status code. 204 signifies a successful delete.
361
+
362
+ Raises:
363
+ MeilisearchCommunicationError: If there was an error communicating with the server.
364
+ MeilisearchApiError: If the Meilisearch API returned an error.
365
+
366
+ Examples:
367
+ >>> from meilisearch_python_sdk import AsyncClient
368
+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
369
+ >>> await client.delete_webhook("abc-123")
370
+ """
371
+ response = await self._http_requests.delete(f"webhooks/{uuid}")
372
+ return response.status_code
373
+
255
374
  async def create_dump(self) -> TaskInfo:
256
375
  """Trigger the creation of a Meilisearch dump.
257
376
 
@@ -1229,6 +1348,124 @@ class Client(BaseClient):
1229
1348
 
1230
1349
  return Network(**response.json())
1231
1350
 
1351
+ def get_webhooks(self) -> Webhooks:
1352
+ """Get all webhooks.
1353
+
1354
+ Returns:
1355
+ An instance of Webhooks containing all configured webhooks.
1356
+
1357
+ Raises:
1358
+ MeilisearchCommunicationError: If there was an error communicating with the server.
1359
+ MeilisearchApiError: If the Meilisearch API returned an error.
1360
+
1361
+ Examples:
1362
+ >>> from meilisearch_python_sdk import Client
1363
+ >>> client = Client("http://localhost.com", "masterKey")
1364
+ >>> webhooks = client.get_webhooks()
1365
+ """
1366
+ response = self._http_requests.get("webhooks")
1367
+
1368
+ return Webhooks(**response.json())
1369
+
1370
+ def get_webhook(self, uuid: str) -> Webhook:
1371
+ """Get a specific webhook by UUID.
1372
+
1373
+ Args:
1374
+ uuid: The webhook's unique identifier.
1375
+
1376
+ Returns:
1377
+ An instance of Webhook containing the webhook information.
1378
+
1379
+ Raises:
1380
+ MeilisearchCommunicationError: If there was an error communicating with the server.
1381
+ MeilisearchApiError: If the Meilisearch API returned an error.
1382
+
1383
+ Examples:
1384
+ >>> from meilisearch_python_sdk import Client
1385
+ >>> client = Client("http://localhost.com", "masterKey")
1386
+ >>> webhook = client.get_webhook("abc-123")
1387
+ """
1388
+ response = self._http_requests.get(f"webhooks/{uuid}")
1389
+
1390
+ return Webhook(**response.json())
1391
+
1392
+ def create_webhook(self, webhook: WebhookCreate) -> Webhook:
1393
+ """Create a new webhook.
1394
+
1395
+ Args:
1396
+ webhook: The webhook configuration to create.
1397
+
1398
+ Returns:
1399
+ The created webhook.
1400
+
1401
+ Raises:
1402
+ MeilisearchCommunicationError: If there was an error communicating with the server.
1403
+ MeilisearchApiError: If the Meilisearch API returned an error.
1404
+
1405
+ Examples:
1406
+ >>> from meilisearch_python_sdk import Client
1407
+ >>> from meilisearch_python_sdk.models.webhook import WebhookCreate
1408
+ >>> client = Client("http://localhost.com", "masterKey")
1409
+ >>> webhook_config = WebhookCreate(
1410
+ >>> url="https://example.com/webhook",
1411
+ >>> headers={"Authorization": "Bearer token"}
1412
+ >>> )
1413
+ >>> webhook = client.create_webhook(webhook_config)
1414
+ """
1415
+ response = self._http_requests.post(
1416
+ "webhooks", webhook.model_dump(by_alias=True, exclude_none=True)
1417
+ )
1418
+
1419
+ return Webhook(**response.json())
1420
+
1421
+ def update_webhook(self, *, uuid: str, webhook: WebhookUpdate) -> Webhook:
1422
+ """Update an existing webhook.
1423
+
1424
+ Args:
1425
+ uuid: The webhook's unique identifier.
1426
+ webhook: The webhook configuration updates.
1427
+
1428
+ Returns:
1429
+ The updated webhook.
1430
+
1431
+ Raises:
1432
+ MeilisearchCommunicationError: If there was an error communicating with the server.
1433
+ MeilisearchApiError: If the Meilisearch API returned an error.
1434
+
1435
+ Examples:
1436
+ >>> from meilisearch_python_sdk import Client
1437
+ >>> from meilisearch_python_sdk.models.webhook import WebhookUpdate
1438
+ >>> client = Client("http://localhost.com", "masterKey")
1439
+ >>> webhook_update = WebhookUpdate(url="https://example.com/new-webhook")
1440
+ >>> webhook = client.update_webhook("abc-123", webhook_update)
1441
+ """
1442
+ response = self._http_requests.patch(
1443
+ f"webhooks/{uuid}", webhook.model_dump(by_alias=True, exclude_none=True)
1444
+ )
1445
+
1446
+ return Webhook(**response.json())
1447
+
1448
+ def delete_webhook(self, uuid: str) -> int:
1449
+ """Delete a webhook.
1450
+
1451
+ Args:
1452
+ uuid: The webhook's unique identifier.
1453
+
1454
+ Returns:
1455
+ The Response status code. 204 signifies a successful delete.
1456
+
1457
+ Raises:
1458
+ MeilisearchCommunicationError: If there was an error communicating with the server.
1459
+ MeilisearchApiError: If the Meilisearch API returned an error.
1460
+
1461
+ Examples:
1462
+ >>> from meilisearch_python_sdk import Client
1463
+ >>> client = Client("http://localhost.com", "masterKey")
1464
+ >>> client.delete_webhook("abc-123")
1465
+ """
1466
+ response = self._http_requests.delete(f"webhooks/{uuid}")
1467
+ return response.status_code
1468
+
1232
1469
  def create_dump(self) -> TaskInfo:
1233
1470
  """Trigger the creation of a Meilisearch dump.
1234
1471
 
@@ -1,8 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import gzip
4
+ from collections.abc import Callable
4
5
  from functools import lru_cache
5
- from typing import Any, Callable
6
+ from typing import Any
6
7
 
7
8
  from httpx import (
8
9
  AsyncClient,
@@ -1 +1 @@
1
- VERSION = "4.10.1"
1
+ VERSION = "5.0.0"
@@ -1,8 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
+ from collections.abc import Callable
4
5
  from functools import wraps
5
- from typing import Any, Callable, NamedTuple
6
+ from typing import Any, NamedTuple
6
7
 
7
8
  from meilisearch_python_sdk import AsyncClient, Client
8
9
  from meilisearch_python_sdk._utils import use_task_groups
@@ -1,10 +1,9 @@
1
1
  from datetime import datetime
2
- from typing import Union
3
2
 
4
3
  from camel_converter.pydantic_base import CamelBase
5
4
 
6
5
 
7
6
  class Version(CamelBase):
8
7
  commit_sha: str
9
- commit_date: Union[datetime, str]
8
+ commit_date: datetime | str
10
9
  pkg_version: str
@@ -0,0 +1,24 @@
1
+ from __future__ import annotations
2
+
3
+ from camel_converter.pydantic_base import CamelBase
4
+
5
+
6
+ class Webhook(CamelBase):
7
+ uuid: str
8
+ url: str
9
+ headers: dict[str, str] | None = None
10
+ is_editable: bool
11
+
12
+
13
+ class Webhooks(CamelBase):
14
+ results: list[Webhook]
15
+
16
+
17
+ class WebhookCreate(CamelBase):
18
+ url: str
19
+ headers: dict[str, str] | None = None
20
+
21
+
22
+ class WebhookUpdate(CamelBase):
23
+ url: str | None = None
24
+ headers: dict[str, str] | None = None
@@ -1,16 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from collections.abc import MutableMapping
4
- from typing import TYPE_CHECKING, Any, Union
4
+ from typing import Any, TypeAlias
5
5
 
6
- if TYPE_CHECKING: # pragma: no cover
7
- import sys
8
-
9
- if sys.version_info >= (3, 10):
10
- from typing import TypeAlias
11
- else:
12
- from typing_extensions import TypeAlias
13
-
14
- Filter: TypeAlias = Union[str, list[Union[str, list[str]]]]
6
+ Filter: TypeAlias = str | list[str | list[str]]
15
7
  JsonDict: TypeAlias = dict[str, Any]
16
8
  JsonMapping: TypeAlias = MutableMapping[str, Any]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meilisearch-python-sdk
3
- Version: 4.10.1
3
+ Version: 5.0.0
4
4
  Summary: A Python client providing both async and sync support for the Meilisearch API
5
5
  Project-URL: repository, https://github.com/sanders41/meilisearch-python-sdk
6
6
  Project-URL: homepage, https://github.com/sanders41/meilisearch-python-sdk
@@ -33,16 +33,15 @@ Classifier: Development Status :: 5 - Production/Stable
33
33
  Classifier: Intended Audience :: Developers
34
34
  Classifier: License :: OSI Approved :: MIT License
35
35
  Classifier: Operating System :: OS Independent
36
- Classifier: Programming Language :: Python :: 3.9
37
36
  Classifier: Programming Language :: Python :: 3.10
38
37
  Classifier: Programming Language :: Python :: 3.11
39
38
  Classifier: Programming Language :: Python :: 3.12
40
39
  Classifier: Programming Language :: Python :: 3.13
40
+ Classifier: Programming Language :: Python :: 3.14
41
41
  Classifier: Typing :: Typed
42
- Requires-Python: >=3.9
42
+ Requires-Python: >=3.10
43
43
  Requires-Dist: aiofiles>=0.7
44
44
  Requires-Dist: camel-converter[pydantic]>=1.0.0
45
- Requires-Dist: eval-type-backport>=0.2.0; python_version < '3.10'
46
45
  Requires-Dist: httpx[http2]>=0.17
47
46
  Requires-Dist: pydantic>=2.0.0
48
47
  Requires-Dist: pyjwt>=2.3.0
@@ -1,17 +1,17 @@
1
1
  meilisearch_python_sdk/__init__.py,sha256=SB0Jlm6FwT13J9xasZKseZzTWBk0hkfe1CWyWmIIZnE,258
2
2
  meilisearch_python_sdk/_batch.py,sha256=Hbt-M8Lt8ZDZqcKToUMzUd5zvT-gku709er4pRlvXWk,5065
3
- meilisearch_python_sdk/_client.py,sha256=wwSNx0pKkVz3tMYw_Zk04C5DmjrqxjP0Hi6iD3l9RAI,81729
4
- meilisearch_python_sdk/_http_requests.py,sha256=O3M3n-t1jAKwccWowPbk-HPD3ExtHq8a3XhnZT5facs,6746
3
+ meilisearch_python_sdk/_client.py,sha256=HA0FdvsVGAHhUt6mVB-sK03bIzVivN7ProcimeQdgjQ,90624
4
+ meilisearch_python_sdk/_http_requests.py,sha256=9NMTKrJDFpdWZKPLNGlRQ54EtqhPXlhov3EoeR3VrwU,6773
5
5
  meilisearch_python_sdk/_task.py,sha256=QgVcqMlZdURRS_oYpB_bTBa5dvT3Sp_-O0-s6TqAxHk,12485
6
6
  meilisearch_python_sdk/_utils.py,sha256=NoCDxJPhjABeuSxFTNCih585UDWdXEUBD_FvdgtScQw,1539
7
- meilisearch_python_sdk/_version.py,sha256=kGC5So1y0NX4r0HRyeDtOc_TKBMg8dz2_O2jpgV8a7k,19
8
- meilisearch_python_sdk/decorators.py,sha256=njMn40P-qOzKGGQLCDpsBKWyj2ai10s4XG4IUBSHoD4,8674
7
+ meilisearch_python_sdk/_version.py,sha256=UrekhTdcEqRWJkHDsjdpY1b7v14zjDSWN5cmJLHSG84,18
8
+ meilisearch_python_sdk/decorators.py,sha256=xtG-ptJkVbPlbC1hJQ6dPgPYqU27VluGwL_CTJuIq3I,8701
9
9
  meilisearch_python_sdk/errors.py,sha256=RNNHXtXLBiCVZaLM2MeKKs9RbRuE-SLRttiPeVAEXgA,2133
10
10
  meilisearch_python_sdk/index.py,sha256=XxUgfOBUo6ClayI94I0AljGW4obam5hBIHeAz7d8f4Q,349474
11
11
  meilisearch_python_sdk/json_handler.py,sha256=c1rGKzYlE0dGfLygQjPqVUNfQkN1JvafBGmIx31JW8g,2044
12
12
  meilisearch_python_sdk/plugins.py,sha256=YySzTuVr4IrogTgrP8q-gZPsew8TwedopjWnTj5eV48,3607
13
13
  meilisearch_python_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- meilisearch_python_sdk/types.py,sha256=WxbQBPfy5S_j9hRKJ74ktuIxkH9Oifn7GYStQjs49Ik,458
14
+ meilisearch_python_sdk/types.py,sha256=-A3WB73EKUCBOOaeqVS_S9_1-QgtjAjl-3v_2XRfpF0,249
15
15
  meilisearch_python_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  meilisearch_python_sdk/models/batch.py,sha256=PYnJxCB_rvOaGM4Z-EFgxHqTaFct_s8djlCXkaa1V8k,1613
17
17
  meilisearch_python_sdk/models/client.py,sha256=nefi6ViSaSd_mtopRAhM9tzzepwChFJUkGTXPAr4RY8,2756
@@ -21,8 +21,9 @@ meilisearch_python_sdk/models/index.py,sha256=WLQOi3_HChko134FkRU1H3_cJjhHJCFclc
21
21
  meilisearch_python_sdk/models/search.py,sha256=U3ph1GW9Xkbw33pIlGDa7rlTGsdvqahjRJjPxUou8n8,3581
22
22
  meilisearch_python_sdk/models/settings.py,sha256=eh0xnro4D_sj8ck2nifa3tBdf2_7RcZlAY_zQhfsY0s,5730
23
23
  meilisearch_python_sdk/models/task.py,sha256=JVYF46ylD-XwqVVNq2offhLOkljaGxPyRVuF6PwLOBU,2174
24
- meilisearch_python_sdk/models/version.py,sha256=YDu-aj5H-d6nSaWRTXzlwWghmZAoiknaw250UyEd48I,215
25
- meilisearch_python_sdk-4.10.1.dist-info/METADATA,sha256=NyLbpQvnUIOg-FrR8_X8IAGFZ3mpnlElcHXQpbh0f34,9764
26
- meilisearch_python_sdk-4.10.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
- meilisearch_python_sdk-4.10.1.dist-info/licenses/LICENSE,sha256=xVzevI1TrlKfM0plmJ7vfK1Muu0V9n-dGE8RnDrOFlM,1069
28
- meilisearch_python_sdk-4.10.1.dist-info/RECORD,,
24
+ meilisearch_python_sdk/models/version.py,sha256=ISU-ZHgpXLBFDuMpWWfKdVo9Dq1HcD7s6HFnCiGTF8Y,184
25
+ meilisearch_python_sdk/models/webhook.py,sha256=zSkEJJdEflinW3_seJTLQ_ZWs4w-pjTD3SS1ZawC32k,455
26
+ meilisearch_python_sdk-5.0.0.dist-info/METADATA,sha256=_0IFiCDSiqS3GgYJ2GKyTfyBWZ89ot0SYUr5zG5jlZc,9699
27
+ meilisearch_python_sdk-5.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
+ meilisearch_python_sdk-5.0.0.dist-info/licenses/LICENSE,sha256=xVzevI1TrlKfM0plmJ7vfK1Muu0V9n-dGE8RnDrOFlM,1069
29
+ meilisearch_python_sdk-5.0.0.dist-info/RECORD,,