Skip to content

Commit 506dd0b

Browse files
algolia-botshortcutsmillotp
committed
fix(specs): ingestion push task payload [skip-bc] (generated)
algolia/api-clients-automation#3607 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 70fb5ba commit 506dd0b

File tree

4 files changed

+54
-24
lines changed

4 files changed

+54
-24
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,15 +958,15 @@ public class IngestionClient(
958958
* - deleteIndex
959959
* - editSettings
960960
* @param taskID Unique identifier of a task.
961-
* @param batchWriteParams Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
961+
* @param pushTaskPayload Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
962962
* @param requestOptions additional request configuration.
963963
*/
964-
public suspend fun pushTask(taskID: String, batchWriteParams: BatchWriteParams, requestOptions: RequestOptions? = null): RunResponse {
964+
public suspend fun pushTask(taskID: String, pushTaskPayload: PushTaskPayload, requestOptions: RequestOptions? = null): RunResponse {
965965
require(taskID.isNotBlank()) { "Parameter `taskID` is required when calling `pushTask`." }
966966
val requestConfig = RequestConfig(
967967
method = RequestMethod.POST,
968968
path = listOf("2", "tasks", "$taskID", "push"),
969-
body = batchWriteParams,
969+
body = pushTaskPayload,
970970
)
971971
return requester.execute(
972972
requestConfig = requestConfig,

client/src/commonMain/kotlin/com/algolia/client/model/ingestion/BatchWriteParams.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.

client/src/commonMain/kotlin/com/algolia/client/model/ingestion/BatchRequest.kt renamed to client/src/commonMain/kotlin/com/algolia/client/model/ingestion/PushTaskPayload.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ import kotlinx.serialization.*
55
import kotlinx.serialization.json.*
66

77
/**
8-
* BatchRequest
8+
* PushTaskPayload
99
*
1010
* @param action
11-
* @param body Operation arguments (varies with specified `action`).
11+
* @param records
1212
*/
1313
@Serializable
14-
public data class BatchRequest(
14+
public data class PushTaskPayload(
1515

1616
@SerialName(value = "action") val action: Action,
1717

18-
/** Operation arguments (varies with specified `action`). */
19-
@SerialName(value = "body") val body: JsonObject,
18+
@SerialName(value = "records") val records: List<PushTaskRecords>,
2019
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
* PushTaskRecords
12+
*
13+
* @param objectID Unique record identifier.
14+
*/
15+
@Serializable(PushTaskRecordsSerializer::class)
16+
public data class PushTaskRecords(
17+
18+
/** Unique record identifier. */
19+
val objectID: String,
20+
21+
val additionalProperties: Map<String, JsonElement>? = null,
22+
)
23+
24+
internal object PushTaskRecordsSerializer : KSerializer<PushTaskRecords> {
25+
26+
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("PushTaskRecords") {
27+
element<String>("objectID")
28+
}
29+
30+
override fun deserialize(decoder: Decoder): PushTaskRecords {
31+
val input = decoder.asJsonDecoder()
32+
val tree = input.decodeJsonObject()
33+
return PushTaskRecords(
34+
objectID = tree.getValue("objectID").let { input.json.decodeFromJsonElement(it) },
35+
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
36+
)
37+
}
38+
39+
override fun serialize(encoder: Encoder, value: PushTaskRecords) {
40+
val output = encoder.asJsonEncoder()
41+
val json = buildJsonObject {
42+
put("objectID", output.json.encodeToJsonElement(value.objectID))
43+
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
44+
}
45+
(encoder as JsonEncoder).encodeJsonElement(json)
46+
}
47+
}

0 commit comments

Comments
 (0)