Skip to content

Commit

Permalink
fix(specs): ingestion push task payload [skip-bc] (generated)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
3 people committed Aug 29, 2024
1 parent 70fb5ba commit 506dd0b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -958,15 +958,15 @@ public class IngestionClient(
* - deleteIndex
* - editSettings
* @param taskID Unique identifier of a task.
* @param batchWriteParams Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
* @param pushTaskPayload Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
* @param requestOptions additional request configuration.
*/
public suspend fun pushTask(taskID: String, batchWriteParams: BatchWriteParams, requestOptions: RequestOptions? = null): RunResponse {
public suspend fun pushTask(taskID: String, pushTaskPayload: PushTaskPayload, requestOptions: RequestOptions? = null): RunResponse {
require(taskID.isNotBlank()) { "Parameter `taskID` is required when calling `pushTask`." }
val requestConfig = RequestConfig(
method = RequestMethod.POST,
path = listOf("2", "tasks", "$taskID", "push"),
body = batchWriteParams,
body = pushTaskPayload,
)
return requester.execute(
requestConfig = requestConfig,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import kotlinx.serialization.*
import kotlinx.serialization.json.*

/**
* BatchRequest
* PushTaskPayload
*
* @param action
* @param body Operation arguments (varies with specified `action`).
* @param records
*/
@Serializable
public data class BatchRequest(
public data class PushTaskPayload(

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

/** Operation arguments (varies with specified `action`). */
@SerialName(value = "body") val body: JsonObject,
@SerialName(value = "records") val records: List<PushTaskRecords>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/** 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. */
package com.algolia.client.model.ingestion

import com.algolia.client.extensions.internal.*
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.json.*

/**
* PushTaskRecords
*
* @param objectID Unique record identifier.
*/
@Serializable(PushTaskRecordsSerializer::class)
public data class PushTaskRecords(

/** Unique record identifier. */
val objectID: String,

val additionalProperties: Map<String, JsonElement>? = null,
)

internal object PushTaskRecordsSerializer : KSerializer<PushTaskRecords> {

override val descriptor: SerialDescriptor = buildClassSerialDescriptor("PushTaskRecords") {
element<String>("objectID")
}

override fun deserialize(decoder: Decoder): PushTaskRecords {
val input = decoder.asJsonDecoder()
val tree = input.decodeJsonObject()
return PushTaskRecords(
objectID = tree.getValue("objectID").let { input.json.decodeFromJsonElement(it) },
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
)
}

override fun serialize(encoder: Encoder, value: PushTaskRecords) {
val output = encoder.asJsonEncoder()
val json = buildJsonObject {
put("objectID", output.json.encodeToJsonElement(value.objectID))
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
}
(encoder as JsonEncoder).encodeJsonElement(json)
}
}

0 comments on commit 506dd0b

Please sign in to comment.