@@ -209,6 +209,28 @@ async def create_index(self, uid: str, primary_key: str | None = None) -> AsyncI
209209 """
210210 return await AsyncIndex .create (self .http_client , uid , primary_key )
211211
212+ async def create_snapshot (self ) -> TaskInfo :
213+ """Trigger the creation of a Meilisearch snapshot.
214+
215+ Returns:
216+
217+ The details of the task.
218+
219+ Raises:
220+
221+ MeilisearchCommunicationError: If there was an error communicating with the server.
222+ MeilisearchApiError: If the Meilisearch API returned an error.
223+
224+ Examples:
225+
226+ >>> from meilisearch_python_sdk import AsyncClient
227+ >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
228+ >>> await client.create_snapshot()
229+ """
230+ response = await self ._http_requests .post ("snapshots" )
231+
232+ return TaskInfo (** response .json ())
233+
212234 async def delete_index_if_exists (self , uid : str ) -> bool :
213235 """Deletes an index if it already exists.
214236
@@ -1015,6 +1037,28 @@ def create_index(self, uid: str, primary_key: str | None = None) -> Index:
10151037 """
10161038 return Index .create (self .http_client , uid , primary_key )
10171039
1040+ def create_snapshot (self ) -> TaskInfo :
1041+ """Trigger the creation of a Meilisearch snapshot.
1042+
1043+ Returns:
1044+
1045+ The details of the task.
1046+
1047+ Raises:
1048+
1049+ MeilisearchCommunicationError: If there was an error communicating with the server.
1050+ MeilisearchApiError: If the Meilisearch API returned an error.
1051+
1052+ Examples:
1053+
1054+ >>> from meilisearch_python_sdk import Client
1055+ >>> client = Client("http://localhost.com", "masterKey")
1056+ >>> client.create_snapshot()
1057+ """
1058+ response = self ._http_requests .post ("snapshots" )
1059+
1060+ return TaskInfo (** response .json ())
1061+
10181062 def delete_index_if_exists (self , uid : str ) -> bool :
10191063 """Deletes an index if it already exists.
10201064
0 commit comments