Skip to content

Commit

Permalink
feat(specs): add v2 endpoints for ingestion
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3416

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
  • Loading branch information
algolia-bot and shortcuts committed Jul 25, 2024
1 parent 3033803 commit fd0af40
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,30 @@ public class IngestionClient(
)
}

/**
* Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
*
* Required API Key ACLs:
* - addObject
* - 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 requestOptions additional request configuration.
*/
public suspend fun pushTask(taskID: String, batchWriteParams: BatchWriteParams, 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,
)
return requester.execute(
requestConfig = requestConfig,
requestOptions = requestOptions,
)
}

/**
* Runs a task. You can check the status of task runs with the observability endpoints.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/** 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 kotlinx.serialization.*

/**
* Type of indexing operation.
*/
@Serializable
public enum class Action(public val value: kotlin.String) {

@SerialName(value = "addObject")
AddObject("addObject"),

@SerialName(value = "updateObject")
UpdateObject("updateObject"),

@SerialName(value = "partialUpdateObject")
PartialUpdateObject("partialUpdateObject"),

@SerialName(value = "partialUpdateObjectNoCreate")
PartialUpdateObjectNoCreate("partialUpdateObjectNoCreate"),

@SerialName(value = "deleteObject")
DeleteObject("deleteObject"),

@SerialName(value = "delete")
Delete("delete"),

@SerialName(value = "clear")
Clear("clear");

override fun toString(): kotlin.String = value
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** 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 kotlinx.serialization.*
import kotlinx.serialization.json.*

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

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

/** Operation arguments (varies with specified `action`). */
@SerialName(value = "body") val body: JsonObject,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** 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 kotlinx.serialization.*
import kotlinx.serialization.json.*

/**
* Batch parameters.
*
* @param requests
*/
@Serializable
public data class BatchWriteParams(

@SerialName(value = "requests") val requests: List<BatchRequest>,
)

0 comments on commit fd0af40

Please sign in to comment.