Skip to content

Commit 50f2e6a

Browse files
algolia-botkai687shortcutsmillotp
committed
fix(specs): partial update operation (generated)
algolia/api-clients-automation#3486 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Kai Welke <[email protected]> Co-authored-by: shortcuts <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent ab21d85 commit 50f2e6a

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/main/scala/algoliasearch/api/SearchClient.scala

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import algoliasearch.search.AddApiKeyResponse
88
import algoliasearch.search.ApiKey
99
import algoliasearch.search.ApiKeyOperation._
1010
import algoliasearch.search.AssignUserIdParams
11-
import algoliasearch.search.AttributeToUpdate
1211
import algoliasearch.search.BatchAssignUserIdsParams
1312
import algoliasearch.search.BatchDictionaryEntriesParams
1413
import algoliasearch.search.BatchParams
@@ -1185,7 +1184,23 @@ class SearchClient(
11851184
/** Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn't
11861185
* exist, a new record is added to the index **if** `createIfNotExists` is true. - If the index doesn't exist yet,
11871186
* this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify
1188-
* a nested attribute, the engine treats it as a replacement for its first-level ancestor.
1187+
* a nested attribute, the engine treats it as a replacement for its first-level ancestor. To update an attribute
1188+
* without pushing the entire record, you can use these built-in operations. These operations can be helpful if you
1189+
* don't have access to your initial data. - Increment: increment a numeric attribute - Decrement: decrement a
1190+
* numeric attribute - Add: append a number or string element to an array attribute - Remove: remove all matching
1191+
* number or string elements from an array attribute made of numbers or strings - AddUnique: add a number or string
1192+
* element to an array attribute made of numbers or strings only if it's not already present - IncrementFrom:
1193+
* increment a numeric integer attribute only if the provided value matches the current value, and otherwise ignore
1194+
* the whole object update. For example, if you pass an IncrementFrom value of 2 for the version attribute, but the
1195+
* current value of the attribute is 1, the engine ignores the update. If the object doesn't exist, the engine only
1196+
* creates it if you pass an IncrementFrom value of 0. - IncrementSet: increment a numeric integer attribute only if
1197+
* the provided value is greater than the current value, and otherwise ignore the whole object update. For example,
1198+
* if you pass an IncrementSet value of 2 for the version attribute, and the current value of the attribute is 1, the
1199+
* engine updates the object. If the object doesn't exist yet, the engine only creates it if you pass an IncrementSet
1200+
* value that's greater than 0. You can specify an operation by providing an object with the attribute to update as
1201+
* the key and its value being an object with the following properties: - _operation: the operation to apply on the
1202+
* attribute - value: the right-hand side argument to the operation, for example, increment or decrement step, value
1203+
* to add or remove.
11891204
*
11901205
* Required API Key ACLs:
11911206
* - addObject
@@ -1202,7 +1217,7 @@ class SearchClient(
12021217
def partialUpdateObject(
12031218
indexName: String,
12041219
objectID: String,
1205-
attributesToUpdate: Map[String, AttributeToUpdate],
1220+
attributesToUpdate: Any,
12061221
createIfNotExists: Option[Boolean] = None,
12071222
requestOptions: Option[RequestOptions] = None
12081223
)(implicit ec: ExecutionContext): Future[UpdatedAtWithObjectIdResponse] = Future {

src/main/scala/algoliasearch/search/AttributeToUpdate.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import algoliasearch.search.BuiltInOperationType._
3838
import org.json4s._
3939

4040
/** AttributeToUpdate
41+
* @deprecated
4142
*/
4243
sealed trait AttributeToUpdate
4344

0 commit comments

Comments
 (0)