diff --git a/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt b/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt index fb58905a..14b56ed1 100644 --- a/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt +++ b/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt @@ -926,6 +926,30 @@ public class IngestionClient( ) } + /** + * Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task. + * + * Required API Key ACLs: + * - addObject + * - deleteIndex + * - editSettings + * @param sourceID Unique identifier of a source. + * @param runSourcePayload + * @param requestOptions additional request configuration. + */ + public suspend fun runSource(sourceID: String, runSourcePayload: RunSourcePayload? = null, requestOptions: RequestOptions? = null): RunSourceResponse { + require(sourceID.isNotBlank()) { "Parameter `sourceID` is required when calling `runSource`." } + val requestConfig = RequestConfig( + method = RequestMethod.POST, + path = listOf("1", "sources", "$sourceID", "run"), + body = runSourcePayload, + ) + return requester.execute( + requestConfig = requestConfig, + requestOptions = requestOptions, + ) + } + /** * Runs a task. You can check the status of task runs with the observability endpoints. * diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/EntityType.kt b/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/EntityType.kt new file mode 100644 index 00000000..44566bdc --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/EntityType.kt @@ -0,0 +1,19 @@ +/** 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 entity to update. + */ +@Serializable +public enum class EntityType(public val value: kotlin.String) { + + @SerialName(value = "product") + Product("product"), + + @SerialName(value = "collection") + Collection("collection"); + + override fun toString(): kotlin.String = value +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/RunSourcePayload.kt b/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/RunSourcePayload.kt new file mode 100644 index 00000000..826bc708 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/RunSourcePayload.kt @@ -0,0 +1,28 @@ +/** 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.* + +/** + * RunSourcePayload + * + * @param indexToInclude List of index names to include in reidexing/update. + * @param indexToExclude List of index names to exclude in reidexing/update. + * @param entityIDs List of entityID to update. + * @param entityType + */ +@Serializable +public data class RunSourcePayload( + + /** List of index names to include in reidexing/update. */ + @SerialName(value = "indexToInclude") val indexToInclude: List? = null, + + /** List of index names to exclude in reidexing/update. */ + @SerialName(value = "indexToExclude") val indexToExclude: List? = null, + + /** List of entityID to update. */ + @SerialName(value = "entityIDs") val entityIDs: List? = null, + + @SerialName(value = "entityType") val entityType: EntityType? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/RunSourceResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/RunSourceResponse.kt new file mode 100644 index 00000000..911e1c7c --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/RunSourceResponse.kt @@ -0,0 +1,21 @@ +/** 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.* + +/** + * RunSourceResponse + * + * @param taskWithRunID Map of taskID sent for reindex with the corresponding runID. + * @param createdAt Date of creation in RFC 3339 format. + */ +@Serializable +public data class RunSourceResponse( + + /** Map of taskID sent for reindex with the corresponding runID. */ + @SerialName(value = "taskWithRunID") val taskWithRunID: Map, + + /** Date of creation in RFC 3339 format. */ + @SerialName(value = "createdAt") val createdAt: String, +)