Skip to content

Commit 69fe082

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 9a32522 commit 69fe082

File tree

12 files changed

+464
-2
lines changed

12 files changed

+464
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ public class SearchClient(
954954
}
955955

956956
/**
957-
* Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn't exist, a new record is added to the index **if** `createIfNotExists` is true. - If the index doesn't exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor.
957+
* Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn't exist, a new record is added to the index **if** `createIfNotExists` is true. - If the index doesn't exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor. To update an attribute without pushing the entire record, you can use these built-in operations. These operations can be helpful if you don't have access to your initial data. - Increment: increment a numeric attribute - Decrement: decrement a numeric attribute - Add: append a number or string element to an array attribute - Remove: remove all matching number or string elements from an array attribute made of numbers or strings - AddUnique: add a number or string element to an array attribute made of numbers or strings only if it's not already present - IncrementFrom: increment a numeric integer attribute only if the provided value matches the current value, and otherwise ignore the whole object update. For example, if you pass an IncrementFrom value of 2 for the version attribute, but the current value of the attribute is 1, the engine ignores the update. If the object doesn't exist, the engine only creates it if you pass an IncrementFrom value of 0. - IncrementSet: increment a numeric integer attribute only if the provided value is greater than the current value, and otherwise ignore the whole object update. For example, if you pass an IncrementSet value of 2 for the version attribute, and the current value of the attribute is 1, the engine updates the object. If the object doesn't exist yet, the engine only creates it if you pass an IncrementSet value that's greater than 0. You can specify an operation by providing an object with the attribute to update as the key and its value being an object with the following properties: - _operation: the operation to apply on the attribute - value: the right-hand side argument to the operation, for example, increment or decrement step, value to add or remove.
958958
*
959959
* Required API Key ACLs:
960960
* - addObject
@@ -964,9 +964,10 @@ public class SearchClient(
964964
* @param createIfNotExists Whether to create a new record if it doesn't exist. (default to true)
965965
* @param requestOptions additional request configuration.
966966
*/
967-
public suspend fun partialUpdateObject(indexName: String, objectID: String, attributesToUpdate: Map<kotlin.String, AttributeToUpdate>, createIfNotExists: Boolean? = null, requestOptions: RequestOptions? = null): UpdatedAtWithObjectIdResponse {
967+
public suspend fun partialUpdateObject(indexName: String, objectID: String, attributesToUpdate: JsonObject, createIfNotExists: Boolean? = null, requestOptions: RequestOptions? = null): UpdatedAtWithObjectIdResponse {
968968
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `partialUpdateObject`." }
969969
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `partialUpdateObject`." }
970+
require(attributesToUpdate.isNotEmpty()) { "Parameter `attributesToUpdate` is required when calling `partialUpdateObject`." }
970971
val requestConfig = RequestConfig(
971972
method = RequestMethod.POST,
972973
path = listOf("1", "indexes", "$indexName", "$objectID", "partial"),
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.abtesting
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.analytics
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.ingestion
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.insights
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.monitoring
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.personalization
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.querysuggestions
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.recommend
3+
4+
import com.algolia.client.extensions.internal.*
5+
import kotlinx.serialization.*
6+
import kotlinx.serialization.descriptors.*
7+
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.json.*
9+
10+
/**
11+
* Error.
12+
*
13+
* @param message
14+
*/
15+
@Serializable(ErrorBaseSerializer::class)
16+
public data class ErrorBase(
17+
18+
val message: String? = null,
19+
20+
val additionalProperties: Map<String, JsonElement>? = null,
21+
)
22+
23+
internal object ErrorBaseSerializer : KSerializer<ErrorBase> {
24+
25+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
26+
element<String>("message", isOptional = true)
27+
}
28+
29+
override fun deserialize(decoder: Decoder): ErrorBase {
30+
val input = decoder.asJsonDecoder()
31+
val tree = input.decodeJsonObject()
32+
return ErrorBase(
33+
message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
34+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
35+
)
36+
}
37+
38+
override fun serialize(encoder: Encoder, value: ErrorBase) {
39+
val output = encoder.asJsonEncoder()
40+
val json = buildJsonObject {
41+
value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
42+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
43+
}
44+
(encoder as JsonEncoder).encodeJsonElement(json)
45+
}
46+
}

0 commit comments

Comments
 (0)