Skip to content

Commit 97a9f7c

Browse files
feat(specs): add global push endpoint (generated)
algolia/api-clients-automation#4855 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent c8ba1ae commit 97a9f7c

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,14 +922,46 @@ public class IngestionClient(
922922
}
923923

924924
/**
925-
* Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
925+
* Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `pushTask`, but requires an `indexName` instead of a `taskID`. If zero or many tasks are found, an error will be returned.
926+
*
927+
* Required API Key ACLs:
928+
* - addObject
929+
* - deleteIndex
930+
* - editSettings
931+
* @param indexName Name of the index on which to perform the operation.
932+
* @param pushTaskPayload
933+
* @param watch When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
934+
* @param requestOptions additional request configuration.
935+
*/
936+
public suspend fun push(indexName: String, pushTaskPayload: PushTaskPayload, watch: Boolean? = null, requestOptions: RequestOptions? = null): WatchResponse {
937+
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `push`." }
938+
val requestConfig = RequestConfig(
939+
method = RequestMethod.POST,
940+
path = listOf("1", "push", "$indexName"),
941+
query = buildMap {
942+
watch?.let { put("watch", it) }
943+
},
944+
body = pushTaskPayload,
945+
)
946+
return requester.execute(
947+
requestConfig = requestConfig,
948+
requestOptions = RequestOptions(
949+
readTimeout = 180000.milliseconds,
950+
writeTimeout = 180000.milliseconds,
951+
connectTimeout = 180000.milliseconds,
952+
) + requestOptions,
953+
)
954+
}
955+
956+
/**
957+
* Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `push`, but requires a `taskID` instead of a `indexName`, which is useful when many `destinations` target the same `indexName`.
926958
*
927959
* Required API Key ACLs:
928960
* - addObject
929961
* - deleteIndex
930962
* - editSettings
931963
* @param taskID Unique identifier of a task.
932-
* @param pushTaskPayload Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
964+
* @param pushTaskPayload
933965
* @param watch When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
934966
* @param requestOptions additional request configuration.
935967
*/

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,7 @@ public enum class Action(public val value: kotlin.String) {
1919
PartialUpdateObject("partialUpdateObject"),
2020

2121
@SerialName(value = "partialUpdateObjectNoCreate")
22-
PartialUpdateObjectNoCreate("partialUpdateObjectNoCreate"),
23-
24-
@SerialName(value = "deleteObject")
25-
DeleteObject("deleteObject"),
26-
27-
@SerialName(value = "delete")
28-
Delete("delete"),
29-
30-
@SerialName(value = "clear")
31-
Clear("clear");
22+
PartialUpdateObjectNoCreate("partialUpdateObjectNoCreate");
3223

3324
override fun toString(): kotlin.String = value
3425
}

0 commit comments

Comments
 (0)