From b7f15d38dc51643395ad94cc11048f65948956af Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Tue, 7 Jan 2025 09:20:36 +0000 Subject: [PATCH] feat(clients): add optionnal scopes to replaceAllObjects [skip-bc] (generated) https://github.com/algolia/api-clients-automation/pull/4296 Co-authored-by: algolia-bot Co-authored-by: Pierre Millot --- src/main/scala/algoliasearch/api/SearchClient.scala | 1 + src/main/scala/algoliasearch/extension/package.scala | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/algoliasearch/api/SearchClient.scala b/src/main/scala/algoliasearch/api/SearchClient.scala index 5a60ff04..e72ed407 100644 --- a/src/main/scala/algoliasearch/api/SearchClient.scala +++ b/src/main/scala/algoliasearch/api/SearchClient.scala @@ -47,6 +47,7 @@ import algoliasearch.search.ReplaceSourceResponse import algoliasearch.search.Rule import algoliasearch.search.SaveObjectResponse import algoliasearch.search.SaveSynonymResponse +import algoliasearch.search.ScopeType._ import algoliasearch.search.SearchDictionaryEntriesParams import algoliasearch.search.SearchDictionaryEntriesResponse import algoliasearch.search.SearchForFacetValuesRequest diff --git a/src/main/scala/algoliasearch/extension/package.scala b/src/main/scala/algoliasearch/extension/package.scala index 52648f87..6af48b15 100644 --- a/src/main/scala/algoliasearch/extension/package.scala +++ b/src/main/scala/algoliasearch/extension/package.scala @@ -353,6 +353,8 @@ package object extension { * The list of objects to replace. * @param batchSize * The size of the batch. Default is 1000. + * @param scopes + * The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms']. * @param requestOptions * Additional request configuration. * @return @@ -362,6 +364,7 @@ package object extension { indexName: String, objects: Seq[Any], batchSize: Int = 1000, + scopes: Option[Seq[ScopeType]] = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms)), requestOptions: Option[RequestOptions] = None )(implicit ec: ExecutionContext): Future[ReplaceAllObjectsResponse] = { val tmpIndexName = s"${indexName}_tmp_${scala.util.Random.nextInt(100)}" @@ -373,7 +376,7 @@ package object extension { operationIndexParams = OperationIndexParams( operation = OperationType.Copy, destination = tmpIndexName, - scope = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms)) + scope = scopes ), requestOptions = requestOptions ) @@ -394,7 +397,7 @@ package object extension { operationIndexParams = OperationIndexParams( operation = OperationType.Copy, destination = tmpIndexName, - scope = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms)) + scope = scopes ), requestOptions = requestOptions )