Skip to content

Commit c3c75dc

Browse files
feat(specs): update transformation specs for no-code (generated)
algolia/api-clients-automation#4901 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Mehmet Ali Gok <33124154+mehmetaligok@users.noreply.github.com>
1 parent c5f0ee6 commit c3c75dc

File tree

7 files changed

+119
-8
lines changed

7 files changed

+119
-8
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import kotlinx.serialization.json.*
88
* Transformation
99
*
1010
* @param transformationID Universally unique identifier (UUID) of a transformation.
11-
* @param code The source code of the transformation.
11+
* @param code It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code.
1212
* @param name The uniquely identified name of your transformation.
1313
* @param createdAt Date of creation in RFC 3339 format.
1414
* @param updatedAt Date of last update in RFC 3339 format.
1515
* @param authenticationIDs The authentications associated with the current transformation.
16+
* @param type
17+
* @param input
1618
* @param description A descriptive name for your transformation of what it does.
1719
* @param owner Owner of the resource.
1820
*/
@@ -22,7 +24,8 @@ public data class Transformation(
2224
/** Universally unique identifier (UUID) of a transformation. */
2325
@SerialName(value = "transformationID") val transformationID: String,
2426

25-
/** The source code of the transformation. */
27+
/** It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code. */
28+
@Deprecated(message = "This property is deprecated.")
2629
@SerialName(value = "code") val code: String,
2730

2831
/** The uniquely identified name of your transformation. */
@@ -37,6 +40,10 @@ public data class Transformation(
3740
/** The authentications associated with the current transformation. */
3841
@SerialName(value = "authenticationIDs") val authenticationIDs: List<String>? = null,
3942

43+
@SerialName(value = "type") val type: TransformationType? = null,
44+
45+
@SerialName(value = "input") val input: TransformationInput? = null,
46+
4047
/** A descriptive name for your transformation of what it does. */
4148
@SerialName(value = "description") val description: String? = null,
4249

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 kotlinx.serialization.*
5+
import kotlinx.serialization.json.*
6+
7+
/**
8+
* Input for a transformation that contains the source code of the transformation.
9+
*
10+
* @param code The source code of the transformation.
11+
*/
12+
@Serializable
13+
public data class TransformationCode(
14+
15+
/** The source code of the transformation. */
16+
@SerialName(value = "code") val code: String,
17+
) : TransformationInput

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ import kotlinx.serialization.json.*
77
/**
88
* API request body for creating a transformation.
99
*
10-
* @param code The source code of the transformation.
1110
* @param name The uniquely identified name of your transformation.
11+
* @param type
12+
* @param input
13+
* @param code It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code.
1214
* @param description A descriptive name for your transformation of what it does.
1315
* @param authenticationIDs The authentications associated with the current transformation.
1416
*/
1517
@Serializable
1618
public data class TransformationCreate(
1719

18-
/** The source code of the transformation. */
19-
@SerialName(value = "code") val code: String,
20-
2120
/** The uniquely identified name of your transformation. */
2221
@SerialName(value = "name") val name: String,
2322

23+
@SerialName(value = "type") val type: TransformationType,
24+
25+
@SerialName(value = "input") val input: TransformationInput,
26+
27+
/** It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code. */
28+
@Deprecated(message = "This property is deprecated.")
29+
@SerialName(value = "code") val code: String? = null,
30+
2431
/** A descriptive name for your transformation of what it does. */
2532
@SerialName(value = "description") val description: String? = null,
2633

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.exception.AlgoliaClientException
5+
import com.algolia.client.extensions.internal.*
6+
import kotlinx.serialization.*
7+
import kotlinx.serialization.builtins.*
8+
import kotlinx.serialization.descriptors.*
9+
import kotlinx.serialization.encoding.*
10+
import kotlinx.serialization.json.*
11+
import kotlin.jvm.JvmInline
12+
13+
/**
14+
* The input for the transformation, which can be either code or a no-code configuration.
15+
*
16+
* Implementations:
17+
* - [TransformationCode]
18+
* - [TransformationNoCode]
19+
*/
20+
@Serializable(TransformationInputSerializer::class)
21+
public sealed interface TransformationInput {
22+
@Serializable
23+
@JvmInline
24+
public value class TransformationCodeValue(public val value: TransformationCode) : TransformationInput
25+
26+
@Serializable
27+
@JvmInline
28+
public value class TransformationNoCodeValue(public val value: TransformationNoCode) : TransformationInput
29+
30+
public companion object {
31+
32+
public fun of(value: TransformationCode): TransformationInput = TransformationCodeValue(value)
33+
34+
public fun of(value: TransformationNoCode): TransformationInput = TransformationNoCodeValue(value)
35+
}
36+
}
37+
38+
internal class TransformationInputSerializer : JsonContentPolymorphicSerializer<TransformationInput>(TransformationInput::class) {
39+
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<TransformationInput> = when {
40+
element is JsonObject -> TransformationCode.serializer()
41+
element is JsonObject -> TransformationNoCode.serializer()
42+
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
43+
}
44+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 kotlinx.serialization.*
5+
import kotlinx.serialization.json.*
6+
7+
/**
8+
* Input for a no-code transformation that contains a series of steps.
9+
*
10+
* @param steps
11+
*/
12+
@Serializable
13+
public data class TransformationNoCode(
14+
15+
@SerialName(value = "steps") val steps: List<JsonObject>,
16+
) : TransformationInput

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import kotlinx.serialization.json.*
77
/**
88
* TransformationTry
99
*
10-
* @param code The source code of the transformation.
10+
* @param code It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code.
1111
* @param sampleRecord The record to apply the given code to.
1212
* @param authentications
1313
*/
1414
@Serializable
1515
public data class TransformationTry(
1616

17-
/** The source code of the transformation. */
17+
/** It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code. */
18+
@Deprecated(message = "This property is deprecated.")
1819
@SerialName(value = "code") val code: String,
1920

2021
/** The record to apply the given code to. */
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 kotlinx.serialization.*
5+
6+
/**
7+
* The type of transformation, which can be either 'code' or 'noCode'.
8+
*/
9+
@Serializable
10+
public enum class TransformationType(public val value: kotlin.String) {
11+
12+
@SerialName(value = "code")
13+
Code("code"),
14+
15+
@SerialName(value = "noCode")
16+
NoCode("noCode");
17+
18+
override fun toString(): kotlin.String = value
19+
}

0 commit comments

Comments
 (0)