Skip to content

Commit 22a77f3

Browse files
feat(clients): expose waitForTasks to batch helpers [skip-bc] (generated)
algolia/api-clients-automation#4030 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 526da2d commit 22a77f3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/main/scala/algoliasearch/extension/package.scala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ package object extension {
251251
* The index in which to perform the request.
252252
* @param objects
253253
* The list of objects to save.
254+
* @param waitForTasks
255+
* Whether to wait for the tasks to complete.
254256
* @param requestOptions
255257
* Additional request configuration.
256258
* @return
@@ -259,9 +261,10 @@ package object extension {
259261
def saveObjects(
260262
indexName: String,
261263
objects: Seq[Any],
264+
waitForTasks: Boolean = false,
262265
requestOptions: Option[RequestOptions] = None
263266
)(implicit ec: ExecutionContext): Future[Seq[BatchResponse]] = {
264-
chunkedBatch(indexName, objects, Action.AddObject, false, 1000, requestOptions)
267+
chunkedBatch(indexName, objects, Action.AddObject, waitForTasks, 1000, requestOptions)
265268
}
266269

267270
/** Helper: Deletes every objects for the given objectIDs. The `chunkedBatch` helper is used under the hood, which
@@ -271,6 +274,8 @@ package object extension {
271274
* The index in which to perform the request.
272275
* @param objectIDs
273276
* The list of objectIDs to delete.
277+
* @param waitForTasks
278+
* Whether to wait for the tasks to complete.
274279
* @param requestOptions
275280
* Additional request configuration.
276281
* @return
@@ -279,13 +284,14 @@ package object extension {
279284
def deleteObjects(
280285
indexName: String,
281286
objectIDs: Seq[String],
287+
waitForTasks: Boolean = false,
282288
requestOptions: Option[RequestOptions] = None
283289
)(implicit ec: ExecutionContext): Future[Seq[BatchResponse]] = {
284290
chunkedBatch(
285291
indexName,
286292
objectIDs.map(id => new { val objectID: String = id }),
287293
Action.DeleteObject,
288-
false,
294+
waitForTasks,
289295
1000,
290296
requestOptions
291297
)
@@ -300,6 +306,8 @@ package object extension {
300306
* The list of objects to save.
301307
* @param createIfNotExists
302308
* To be provided if non-existing objects are passed, otherwise, the call will fail.
309+
* @param waitForTasks
310+
* Whether to wait for the tasks to complete.
303311
* @param requestOptions
304312
* Additional request configuration.
305313
* @return
@@ -309,13 +317,14 @@ package object extension {
309317
indexName: String,
310318
objects: Seq[Any],
311319
createIfNotExists: Boolean = false,
320+
waitForTasks: Boolean = false,
312321
requestOptions: Option[RequestOptions] = None
313322
)(implicit ec: ExecutionContext): Future[Seq[BatchResponse]] = {
314323
chunkedBatch(
315324
indexName,
316325
objects,
317326
if (createIfNotExists) Action.PartialUpdateObject else Action.PartialUpdateObjectNoCreate,
318-
false,
327+
waitForTasks,
319328
1000,
320329
requestOptions
321330
)

0 commit comments

Comments
 (0)