Skip to content

Commit 2b868d8

Browse files
algolia-botmillotp
andcommitted
feat(clients): add optionnal scopes to replaceAllObjects [skip-bc] (generated)
algolia/api-clients-automation#4296 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 94a2179 commit 2b868d8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

client/src/commonMain/kotlin/com/algolia/client/extensions/SearchClient.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,14 @@ public suspend fun SearchClient.partialUpdateObjects(
462462
* @param indexName The index in which to perform the request.
463463
* @param objects The list of objects to replace.
464464
* @param batchSize The size of the batch. Default is 1000.
465+
* @param scopes The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
465466
* @return responses from the three-step operations: copy, batch, move.
466467
*/
467468
public suspend fun SearchClient.replaceAllObjects(
468469
indexName: String,
469470
objects: List<JsonObject>,
470471
batchSize: Int = 1000,
472+
scopes: List<ScopeType> = listOf(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms),
471473
requestOptions: RequestOptions? = null,
472474
): ReplaceAllObjectsResponse {
473475
val tmpIndexName = "${indexName}_tmp_${Random.nextInt(from = 0, until = 100)}"
@@ -478,7 +480,7 @@ public suspend fun SearchClient.replaceAllObjects(
478480
operationIndexParams = OperationIndexParams(
479481
operation = OperationType.Copy,
480482
destination = tmpIndexName,
481-
scope = listOf(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms),
483+
scope = scopes,
482484
),
483485
requestOptions = requestOptions,
484486
)
@@ -499,7 +501,7 @@ public suspend fun SearchClient.replaceAllObjects(
499501
operationIndexParams = OperationIndexParams(
500502
operation = OperationType.Copy,
501503
destination = tmpIndexName,
502-
scope = listOf(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms),
504+
scope = scopes,
503505
),
504506
requestOptions = requestOptions,
505507
)

0 commit comments

Comments
 (0)