Skip to content

Commit

Permalink
feat(clients): expose waitForTasks to batch helpers [skip-bc] (genera…
Browse files Browse the repository at this point in the history
…ted)

algolia/api-clients-automation#4030

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed Oct 28, 2024
1 parent e8d3af3 commit 2006915
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions algoliasearch/search/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ async def save_objects(
self,
index_name: str,
objects: List[Dict[str, Any]],
wait_for_tasks: bool = False,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> List[BatchResponse]:
"""
Expand All @@ -500,13 +501,15 @@ async def save_objects(
index_name=index_name,
objects=objects,
action=Action.ADDOBJECT,
wait_for_tasks=wait_for_tasks,
request_options=request_options,
)

async def delete_objects(
self,
index_name: str,
object_ids: List[str],
wait_for_tasks: bool = False,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> List[BatchResponse]:
"""
Expand All @@ -516,6 +519,7 @@ async def delete_objects(
index_name=index_name,
objects=[{"objectID": id} for id in object_ids],
action=Action.DELETEOBJECT,
wait_for_tasks=wait_for_tasks,
request_options=request_options,
)

Expand All @@ -524,6 +528,7 @@ async def partial_update_objects(
index_name: str,
objects: List[Dict[str, Any]],
create_if_not_exists: bool = False,
wait_for_tasks: bool = False,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> List[BatchResponse]:
"""
Expand All @@ -535,6 +540,7 @@ async def partial_update_objects(
action=Action.PARTIALUPDATEOBJECT
if create_if_not_exists
else Action.PARTIALUPDATEOBJECTNOCREATE,
wait_for_tasks=wait_for_tasks,
request_options=request_options,
)

Expand Down Expand Up @@ -5494,6 +5500,7 @@ def save_objects(
self,
index_name: str,
objects: List[Dict[str, Any]],
wait_for_tasks: bool = False,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> List[BatchResponse]:
"""
Expand All @@ -5503,13 +5510,15 @@ def save_objects(
index_name=index_name,
objects=objects,
action=Action.ADDOBJECT,
wait_for_tasks=wait_for_tasks,
request_options=request_options,
)

def delete_objects(
self,
index_name: str,
object_ids: List[str],
wait_for_tasks: bool = False,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> List[BatchResponse]:
"""
Expand All @@ -5519,6 +5528,7 @@ def delete_objects(
index_name=index_name,
objects=[{"objectID": id} for id in object_ids],
action=Action.DELETEOBJECT,
wait_for_tasks=wait_for_tasks,
request_options=request_options,
)

Expand All @@ -5527,6 +5537,7 @@ def partial_update_objects(
index_name: str,
objects: List[Dict[str, Any]],
create_if_not_exists: bool = False,
wait_for_tasks: bool = False,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> List[BatchResponse]:
"""
Expand All @@ -5538,6 +5549,7 @@ def partial_update_objects(
action=Action.PARTIALUPDATEOBJECT
if create_if_not_exists
else Action.PARTIALUPDATEOBJECTNOCREATE,
wait_for_tasks=wait_for_tasks,
request_options=request_options,
)

Expand Down

0 comments on commit 2006915

Please sign in to comment.