diff --git a/client/src/commonMain/kotlin/com/algolia/client/api/CompositionClient.kt b/client/src/commonMain/kotlin/com/algolia/client/api/CompositionClient.kt new file mode 100644 index 00000000..b2553e9d --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/api/CompositionClient.kt @@ -0,0 +1,83 @@ +/** 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.api + +import com.algolia.client.configuration.* +import com.algolia.client.exception.* +import com.algolia.client.extensions.internal.* +import com.algolia.client.model.composition.* +import com.algolia.client.model.composition.RequestBody +import com.algolia.client.transport.* +import com.algolia.client.transport.internal.* +import kotlinx.serialization.json.* +import kotlin.time.Duration.Companion.milliseconds + +public class CompositionClient( + override val appId: String, + override var apiKey: String, + override val options: ClientOptions = ClientOptions(), +) : ApiClient { + + init { + require(appId.isNotBlank()) { "`appId` is missing." } + require(apiKey.isNotBlank()) { "`apiKey` is missing." } + } + + override val requester: Requester = requesterOf(clientName = "Composition", appId = appId, apiKey = apiKey, connectTimeout = 2000.milliseconds, readTimeout = 5000.milliseconds, writeTimeout = 30000.milliseconds, options = options) { + listOf( + Host("$appId-dsn.algolia.net", CallType.Read), + Host("$appId.algolia.net", CallType.Write), + ) + mutableListOf( + Host("$appId-1.algolianet.com"), + Host("$appId-2.algolianet.com"), + Host("$appId-3.algolianet.com"), + ).apply { shuffle() } + } + + /** + * Runs a query on a single composition and returns matching results. + * + * Required API Key ACLs: + * - search + * @param compositionID Unique Composition ObjectID. + * @param requestBody + * @param requestOptions additional request configuration. + */ + public suspend fun search(compositionID: String, requestBody: RequestBody, requestOptions: RequestOptions? = null): SearchResponse { + require(compositionID.isNotBlank()) { "Parameter `compositionID` is required when calling `search`." } + val requestConfig = RequestConfig( + method = RequestMethod.POST, + path = listOf("1", "compositions", "$compositionID", "run"), + isRead = true, + body = requestBody, + ) + return requester.execute( + requestConfig = requestConfig, + requestOptions = requestOptions, + ) + } + + /** + * Searches for values of a specified facet attribute on the composition's main source's index. - By default, facet values are sorted by decreasing count. You can adjust this with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than 65 searchable facets and searchable attributes combined**. + * + * Required API Key ACLs: + * - search + * @param compositionID Unique Composition ObjectID. + * @param facetName Facet attribute in which to search for values. This attribute must be included in the `attributesForFaceting` index setting with the `searchable()` modifier. + * @param searchForFacetValuesRequest + * @param requestOptions additional request configuration. + */ + public suspend fun searchForFacetValues(compositionID: String, facetName: String, searchForFacetValuesRequest: SearchForFacetValuesRequest? = null, requestOptions: RequestOptions? = null): SearchForFacetValuesResponse { + require(compositionID.isNotBlank()) { "Parameter `compositionID` is required when calling `searchForFacetValues`." } + require(facetName.isNotBlank()) { "Parameter `facetName` is required when calling `searchForFacetValues`." } + val requestConfig = RequestConfig( + method = RequestMethod.POST, + path = listOf("1", "compositions", "$compositionID", "facets", "$facetName", "query"), + isRead = true, + body = searchForFacetValuesRequest, + ) + return requester.execute( + requestConfig = requestConfig, + requestOptions = requestOptions, + ) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundPrecision.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundPrecision.kt new file mode 100644 index 00000000..23ec8ee7 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundPrecision.kt @@ -0,0 +1,44 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * Precision of a coordinate-based search in meters to group results with similar distances. The Geo ranking criterion considers all matches within the same range of distances to be equal. + * + * Implementations: + * - [Int] - *[AroundPrecision.of]* + * - [List] - *[AroundPrecision.of]* + */ +@Serializable(AroundPrecisionSerializer::class) +public sealed interface AroundPrecision { + @Serializable + @JvmInline + public value class IntValue(public val value: Int) : AroundPrecision + + @Serializable + @JvmInline + public value class ListOfRangeValue(public val value: List) : AroundPrecision + + public companion object { + + public fun of(value: Int): AroundPrecision = IntValue(value) + + public fun of(value: List): AroundPrecision = ListOfRangeValue(value) + } +} + +internal class AroundPrecisionSerializer : JsonContentPolymorphicSerializer(AroundPrecision::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element.isInt -> AroundPrecision.IntValue.serializer() + element is JsonArray -> AroundPrecision.ListOfRangeValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundRadius.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundRadius.kt new file mode 100644 index 00000000..6f9a5062 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundRadius.kt @@ -0,0 +1,44 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * Maximum radius for a search around a central location. This parameter works in combination with the `aroundLatLng` and `aroundLatLngViaIP` parameters. By default, the search radius is determined automatically from the density of hits around the central location. The search radius is small if there are many hits close to the central coordinates. + * + * Implementations: + * - [AroundRadiusAll] + * - [Int] - *[AroundRadius.of]* + */ +@Serializable(AroundRadiusSerializer::class) +public sealed interface AroundRadius { + @Serializable + @JvmInline + public value class IntValue(public val value: Int) : AroundRadius + + @Serializable + @JvmInline + public value class AroundRadiusAllValue(public val value: AroundRadiusAll) : AroundRadius + + public companion object { + + public fun of(value: Int): AroundRadius = IntValue(value) + + public fun of(value: AroundRadiusAll): AroundRadius = AroundRadiusAllValue(value) + } +} + +internal class AroundRadiusSerializer : JsonContentPolymorphicSerializer(AroundRadius::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element.isInt -> AroundRadius.IntValue.serializer() + element.isString -> AroundRadiusAll.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundRadiusAll.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundRadiusAll.kt new file mode 100644 index 00000000..d254d53d --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/AroundRadiusAll.kt @@ -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.composition + +import kotlinx.serialization.* + +/** + * Return all records with a valid `_geoloc` attribute. Don't filter by distance. + */ +@Serializable +public enum class AroundRadiusAll(public val value: kotlin.String) : AroundRadius { + + @SerialName(value = "all") + All("all"); + + override fun toString(): kotlin.String = value +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Banner.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Banner.kt new file mode 100644 index 00000000..e9443bc3 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Banner.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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Banner with image and link to redirect users. + * + * @param image + * @param link + */ +@Serializable +public data class Banner( + + @SerialName(value = "image") val image: BannerImage? = null, + + @SerialName(value = "link") val link: BannerLink? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerImage.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerImage.kt new file mode 100644 index 00000000..4cb9f9b9 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerImage.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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Image to show inside a banner. + * + * @param urls + * @param title + */ +@Serializable +public data class BannerImage( + + @SerialName(value = "urls") val urls: List? = null, + + @SerialName(value = "title") val title: String? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerImageUrl.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerImageUrl.kt new file mode 100644 index 00000000..f0317292 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerImageUrl.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * URL for an image to show inside a banner. + * + * @param url + */ +@Serializable +public data class BannerImageUrl( + + @SerialName(value = "url") val url: String? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerLink.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerLink.kt new file mode 100644 index 00000000..78e500fa --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/BannerLink.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Link for a banner defined in the Merchandising Studio. + * + * @param url + */ +@Serializable +public data class BannerLink( + + @SerialName(value = "url") val url: String? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionIdRankingInfo.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionIdRankingInfo.kt new file mode 100644 index 00000000..551e4de0 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionIdRankingInfo.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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * CompositionIdRankingInfo + * + * @param index + * @param injectedItemKey + */ +@Serializable +public data class CompositionIdRankingInfo( + + @SerialName(value = "index") val index: String, + + @SerialName(value = "injectedItemKey") val injectedItemKey: String, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionRunAppliedRules.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionRunAppliedRules.kt new file mode 100644 index 00000000..f5f2ba0e --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionRunAppliedRules.kt @@ -0,0 +1,17 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * CompositionRunAppliedRules + * + * @param objectID Unique record identifier. + */ +@Serializable +public data class CompositionRunAppliedRules( + + /** Unique record identifier. */ + @SerialName(value = "objectID") val objectID: String, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionRunSearchResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionRunSearchResponse.kt new file mode 100644 index 00000000..36218030 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionRunSearchResponse.kt @@ -0,0 +1,53 @@ +/** 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.composition + +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* + +/** + * CompositionRunSearchResponse + * + * @param objectID Unique record identifier. + * @param appliedRules + */ +@Serializable(CompositionRunSearchResponseSerializer::class) +public data class CompositionRunSearchResponse( + + /** Unique record identifier. */ + val objectID: String, + + val appliedRules: List? = null, + + val additionalProperties: Map? = null, +) + +internal object CompositionRunSearchResponseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("CompositionRunSearchResponse") { + element("objectID") + element>("appliedRules", isOptional = true) + } + + override fun deserialize(decoder: Decoder): CompositionRunSearchResponse { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return CompositionRunSearchResponse( + objectID = tree.getValue("objectID").let { input.json.decodeFromJsonElement(it) }, + appliedRules = tree["appliedRules"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: CompositionRunSearchResponse) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + put("objectID", output.json.encodeToJsonElement(value.objectID)) + value.appliedRules?.let { put("appliedRules", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionsSearchResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionsSearchResponse.kt new file mode 100644 index 00000000..a04d00dc --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/CompositionsSearchResponse.kt @@ -0,0 +1,46 @@ +/** 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.composition + +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* + +/** + * CompositionsSearchResponse + * + * @param run + */ +@Serializable(CompositionsSearchResponseSerializer::class) +public data class CompositionsSearchResponse( + + val run: List, + + val additionalProperties: Map? = null, +) + +internal object CompositionsSearchResponseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("CompositionsSearchResponse") { + element>("run") + } + + override fun deserialize(decoder: Decoder): CompositionsSearchResponse { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return CompositionsSearchResponse( + run = tree.getValue("run").let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: CompositionsSearchResponse) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + put("run", output.json.encodeToJsonElement(value.run)) + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/ErrorBase.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ErrorBase.kt new file mode 100644 index 00000000..eb0a70da --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ErrorBase.kt @@ -0,0 +1,46 @@ +/** 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.composition + +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* + +/** + * Error. + * + * @param message + */ +@Serializable(ErrorBaseSerializer::class) +public data class ErrorBase( + + val message: String? = null, + + val additionalProperties: Map? = null, +) + +internal object ErrorBaseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") { + element("message", isOptional = true) + } + + override fun deserialize(decoder: Decoder): ErrorBase { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return ErrorBase( + message = tree["message"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: ErrorBase) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + value.message?.let { put("message", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Exhaustive.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Exhaustive.kt new file mode 100644 index 00000000..8660807b --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Exhaustive.kt @@ -0,0 +1,33 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Whether certain properties of the search response are calculated exhaustive (exact) or approximated. + * + * @param facetsCount Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + * @param facetValues The value is `false` if not all facet values are retrieved. + * @param nbHits Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + * @param rulesMatch Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + * @param typo Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + */ +@Serializable +public data class Exhaustive( + + /** Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). */ + @SerialName(value = "facetsCount") val facetsCount: Boolean? = null, + + /** The value is `false` if not all facet values are retrieved. */ + @SerialName(value = "facetValues") val facetValues: Boolean? = null, + + /** Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. */ + @SerialName(value = "nbHits") val nbHits: Boolean? = null, + + /** Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. */ + @SerialName(value = "rulesMatch") val rulesMatch: Boolean? = null, + + /** Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. */ + @SerialName(value = "typo") val typo: Boolean? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetFilters.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetFilters.kt new file mode 100644 index 00000000..7399e587 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetFilters.kt @@ -0,0 +1,44 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * Filter the search by facet values, so that only records with the same facet values are retrieved. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** - `[filter1, filter2]` is interpreted as `filter1 AND filter2`. - `[[filter1, filter2], filter3]` is interpreted as `filter1 OR filter2 AND filter3`. - `facet:-value` is interpreted as `NOT facet:value`. While it's best to avoid attributes that start with a `-`, you can still filter them by escaping with a backslash: `facet:\\-value`. + * + * Implementations: + * - [List] - *[FacetFilters.of]* + * - [String] - *[FacetFilters.of]* + */ +@Serializable(FacetFiltersSerializer::class) +public sealed interface FacetFilters { + @Serializable + @JvmInline + public value class ListOfFacetFiltersValue(public val value: List) : FacetFilters + + @Serializable + @JvmInline + public value class StringValue(public val value: String) : FacetFilters + + public companion object { + + public fun of(value: List): FacetFilters = ListOfFacetFiltersValue(value) + + public fun of(value: String): FacetFilters = StringValue(value) + } +} + +internal class FacetFiltersSerializer : JsonContentPolymorphicSerializer(FacetFilters::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element is JsonArray -> FacetFilters.ListOfFacetFiltersValue.serializer() + element.isString -> FacetFilters.StringValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetHits.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetHits.kt new file mode 100644 index 00000000..2f2726c0 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetHits.kt @@ -0,0 +1,25 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * FacetHits + * + * @param `value` Facet value. + * @param highlighted Highlighted attribute value, including HTML tags. + * @param count Number of records with this facet value. [The count may be approximated](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ +@Serializable +public data class FacetHits( + + /** Facet value. */ + @SerialName(value = "value") val `value`: String, + + /** Highlighted attribute value, including HTML tags. */ + @SerialName(value = "highlighted") val highlighted: String, + + /** Number of records with this facet value. [The count may be approximated](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). */ + @SerialName(value = "count") val count: Int, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetOrdering.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetOrdering.kt new file mode 100644 index 00000000..b50d8bf0 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetOrdering.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Order of facet names and facet values in your UI. + * + * @param facets + * @param values Order of facet values. One object for each facet. + */ +@Serializable +public data class FacetOrdering( + + @SerialName(value = "facets") val facets: Facets? = null, + + /** Order of facet values. One object for each facet. */ + @SerialName(value = "values") val values: Map? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetStats.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetStats.kt new file mode 100644 index 00000000..68d43fc4 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/FacetStats.kt @@ -0,0 +1,29 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * FacetStats + * + * @param min Minimum value in the results. + * @param max Maximum value in the results. + * @param avg Average facet value in the results. + * @param sum Sum of all values in the results. + */ +@Serializable +public data class FacetStats( + + /** Minimum value in the results. */ + @SerialName(value = "min") val min: Double? = null, + + /** Maximum value in the results. */ + @SerialName(value = "max") val max: Double? = null, + + /** Average facet value in the results. */ + @SerialName(value = "avg") val avg: Double? = null, + + /** Sum of all values in the results. */ + @SerialName(value = "sum") val sum: Double? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Facets.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Facets.kt new file mode 100644 index 00000000..4bc15062 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Facets.kt @@ -0,0 +1,17 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Order of facet names. + * + * @param order Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. + */ +@Serializable +public data class Facets( + + /** Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. */ + @SerialName(value = "order") val order: List? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/HighlightResult.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/HighlightResult.kt new file mode 100644 index 00000000..64974532 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/HighlightResult.kt @@ -0,0 +1,52 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * HighlightResult + * + * Implementations: + * - [HighlightResultOption] + * - [List] - *[HighlightResult.of]* + * - [Map] - *[HighlightResult.of]* + */ +@Serializable(HighlightResultSerializer::class) +public sealed interface HighlightResult { + @Serializable + @JvmInline + public value class HighlightResultOptionValue(public val value: HighlightResultOption) : HighlightResult + + @Serializable + @JvmInline + public value class MapOfkotlinStringHighlightResultValue(public val value: Map) : HighlightResult + + @Serializable + @JvmInline + public value class ListOfHighlightResultValue(public val value: List) : HighlightResult + + public companion object { + + public fun of(value: HighlightResultOption): HighlightResult = HighlightResultOptionValue(value) + + public fun of(value: Map): HighlightResult = MapOfkotlinStringHighlightResultValue(value) + + public fun of(value: List): HighlightResult = ListOfHighlightResultValue(value) + } +} + +internal class HighlightResultSerializer : JsonContentPolymorphicSerializer(HighlightResult::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element is JsonObject && element.containsKey("matchLevel") && element.containsKey("matchedWords") -> HighlightResultOption.serializer() + element is JsonObject -> HighlightResult.MapOfkotlinStringHighlightResultValue.serializer() + element is JsonArray -> HighlightResult.ListOfHighlightResultValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/HighlightResultOption.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/HighlightResultOption.kt new file mode 100644 index 00000000..6119fcd2 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/HighlightResultOption.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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Surround words that match the query with HTML tags for highlighting. + * + * @param `value` Highlighted attribute value, including HTML tags. + * @param matchLevel + * @param matchedWords List of matched words from the search query. + * @param fullyHighlighted Whether the entire attribute value is highlighted. + */ +@Serializable +public data class HighlightResultOption( + + /** Highlighted attribute value, including HTML tags. */ + @SerialName(value = "value") val `value`: String, + + @SerialName(value = "matchLevel") val matchLevel: MatchLevel, + + /** List of matched words from the search query. */ + @SerialName(value = "matchedWords") val matchedWords: List, + + /** Whether the entire attribute value is highlighted. */ + @SerialName(value = "fullyHighlighted") val fullyHighlighted: Boolean? = null, +) : HighlightResult diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Hit.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Hit.kt new file mode 100644 index 00000000..91a57dc1 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Hit.kt @@ -0,0 +1,73 @@ +/** 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.composition + +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* + +/** + * Search result. A hit is a record from your index, augmented with special attributes for highlighting, snippeting, and ranking. + * + * @param objectID Unique record identifier. + * @param highlightResult Surround words that match the query with HTML tags for highlighting. + * @param snippetResult Snippets that show the context around a matching search query. + * @param rankingInfo + * @param distinctSeqID + */ +@Serializable(HitSerializer::class) +public data class Hit( + + /** Unique record identifier. */ + val objectID: String, + + /** Surround words that match the query with HTML tags for highlighting. */ + val highlightResult: Map? = null, + + /** Snippets that show the context around a matching search query. */ + val snippetResult: Map? = null, + + val rankingInfo: HitRankingInfo? = null, + + val distinctSeqID: Int? = null, + + val additionalProperties: Map? = null, +) + +internal object HitSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("Hit") { + element("objectID") + element>("_highlightResult", isOptional = true) + element>("_snippetResult", isOptional = true) + element("_rankingInfo", isOptional = true) + element("_distinctSeqID", isOptional = true) + } + + override fun deserialize(decoder: Decoder): Hit { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return Hit( + objectID = tree.getValue("objectID").let { input.json.decodeFromJsonElement(it) }, + highlightResult = tree["_highlightResult"]?.let { input.json.decodeFromJsonElement(it) }, + snippetResult = tree["_snippetResult"]?.let { input.json.decodeFromJsonElement(it) }, + rankingInfo = tree["_rankingInfo"]?.let { input.json.decodeFromJsonElement(it) }, + distinctSeqID = tree["_distinctSeqID"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: Hit) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + put("objectID", output.json.encodeToJsonElement(value.objectID)) + value.highlightResult?.let { put("_highlightResult", output.json.encodeToJsonElement(it)) } + value.snippetResult?.let { put("_snippetResult", output.json.encodeToJsonElement(it)) } + value.rankingInfo?.let { put("_rankingInfo", output.json.encodeToJsonElement(it)) } + value.distinctSeqID?.let { put("_distinctSeqID", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/HitRankingInfo.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/HitRankingInfo.kt new file mode 100644 index 00000000..1d926291 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/HitRankingInfo.kt @@ -0,0 +1,66 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * HitRankingInfo + * + * @param firstMatchedWord Position of the first matched word in the best matching attribute of the record. + * @param geoDistance Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + * @param nbExactWords Number of exactly matched words. + * @param nbTypos Number of typos encountered when matching the record. + * @param userScore Overall ranking of the record, expressed as a single integer. This attribute is internal. + * @param filters Whether a filter matched the query. + * @param geoPrecision Precision used when computing the geo distance, in meters. + * @param matchedGeoLocation + * @param personalization + * @param promoted Whether the record was promoted by a rule. + * @param proximityDistance Number of words between multiple matches in the query plus 1. For single word queries, `proximityDistance` is 0. + * @param words Number of matched words. + * @param promotedByReRanking Whether the record is re-ranked. + * @param composed + */ +@Serializable +public data class HitRankingInfo( + + /** Position of the first matched word in the best matching attribute of the record. */ + @SerialName(value = "firstMatchedWord") val firstMatchedWord: Int, + + /** Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). */ + @SerialName(value = "geoDistance") val geoDistance: Int, + + /** Number of exactly matched words. */ + @SerialName(value = "nbExactWords") val nbExactWords: Int, + + /** Number of typos encountered when matching the record. */ + @SerialName(value = "nbTypos") val nbTypos: Int, + + /** Overall ranking of the record, expressed as a single integer. This attribute is internal. */ + @SerialName(value = "userScore") val userScore: Int, + + /** Whether a filter matched the query. */ + @SerialName(value = "filters") val filters: Int? = null, + + /** Precision used when computing the geo distance, in meters. */ + @SerialName(value = "geoPrecision") val geoPrecision: Int? = null, + + @SerialName(value = "matchedGeoLocation") val matchedGeoLocation: MatchedGeoLocation? = null, + + @SerialName(value = "personalization") val personalization: Personalization? = null, + + /** Whether the record was promoted by a rule. */ + @SerialName(value = "promoted") val promoted: Boolean? = null, + + /** Number of words between multiple matches in the query plus 1. For single word queries, `proximityDistance` is 0. */ + @SerialName(value = "proximityDistance") val proximityDistance: Int? = null, + + /** Number of matched words. */ + @SerialName(value = "words") val words: Int? = null, + + /** Whether the record is re-ranked. */ + @SerialName(value = "promotedByReRanking") val promotedByReRanking: Boolean? = null, + + @SerialName(value = "composed") val composed: Map? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/InsideBoundingBox.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/InsideBoundingBox.kt new file mode 100644 index 00000000..2fc87b0a --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/InsideBoundingBox.kt @@ -0,0 +1,44 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * InsideBoundingBox + * + * Implementations: + * - [List>] - *[InsideBoundingBox.of]* + * - [String] - *[InsideBoundingBox.of]* + */ +@Serializable(InsideBoundingBoxSerializer::class) +public sealed interface InsideBoundingBox { + @Serializable + @JvmInline + public value class StringValue(public val value: String) : InsideBoundingBox + + @Serializable + @JvmInline + public value class ListOfListOfDoubleValue(public val value: List>) : InsideBoundingBox + + public companion object { + + public fun of(value: String): InsideBoundingBox = StringValue(value) + + public fun of(value: List>): InsideBoundingBox = ListOfListOfDoubleValue(value) + } +} + +internal class InsideBoundingBoxSerializer : JsonContentPolymorphicSerializer(InsideBoundingBox::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element.isString -> InsideBoundingBox.StringValue.serializer() + element is JsonArray -> InsideBoundingBox.ListOfListOfDoubleValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/MatchLevel.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/MatchLevel.kt new file mode 100644 index 00000000..531bc349 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/MatchLevel.kt @@ -0,0 +1,22 @@ +/** 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.composition + +import kotlinx.serialization.* + +/** + * Whether the whole query string matches or only a part. + */ +@Serializable +public enum class MatchLevel(public val value: kotlin.String) { + + @SerialName(value = "none") + None("none"), + + @SerialName(value = "partial") + Partial("partial"), + + @SerialName(value = "full") + Full("full"); + + override fun toString(): kotlin.String = value +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/MatchedGeoLocation.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/MatchedGeoLocation.kt new file mode 100644 index 00000000..5825f685 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/MatchedGeoLocation.kt @@ -0,0 +1,25 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * MatchedGeoLocation + * + * @param lat Latitude of the matched location. + * @param lng Longitude of the matched location. + * @param distance Distance between the matched location and the search location (in meters). + */ +@Serializable +public data class MatchedGeoLocation( + + /** Latitude of the matched location. */ + @SerialName(value = "lat") val lat: Double? = null, + + /** Longitude of the matched location. */ + @SerialName(value = "lng") val lng: Double? = null, + + /** Distance between the matched location and the search location (in meters). */ + @SerialName(value = "distance") val distance: Int? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/NumericFilters.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/NumericFilters.kt new file mode 100644 index 00000000..8896607b --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/NumericFilters.kt @@ -0,0 +1,44 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * Filter by numeric facets. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** You can use numeric comparison operators: `<`, `<=`, `=`, `!=`, `>`, `>=`. Comparisons are precise up to 3 decimals. You can also provide ranges: `facet: TO `. The range includes the lower and upper boundaries. The same combination rules apply as for `facetFilters`. + * + * Implementations: + * - [List] - *[NumericFilters.of]* + * - [String] - *[NumericFilters.of]* + */ +@Serializable(NumericFiltersSerializer::class) +public sealed interface NumericFilters { + @Serializable + @JvmInline + public value class ListOfNumericFiltersValue(public val value: List) : NumericFilters + + @Serializable + @JvmInline + public value class StringValue(public val value: String) : NumericFilters + + public companion object { + + public fun of(value: List): NumericFilters = ListOfNumericFiltersValue(value) + + public fun of(value: String): NumericFilters = StringValue(value) + } +} + +internal class NumericFiltersSerializer : JsonContentPolymorphicSerializer(NumericFilters::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element is JsonArray -> NumericFilters.ListOfNumericFiltersValue.serializer() + element.isString -> NumericFilters.StringValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/OptionalFilters.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/OptionalFilters.kt new file mode 100644 index 00000000..3a6c3ad0 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/OptionalFilters.kt @@ -0,0 +1,44 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don't exclude records from the search results. Records that match the optional filter rank before records that don't match. If you're using a negative filter `facet:-value`, matching records rank after records that don't match. - Optional filters don't work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters are applied _before_ custom ranking attributes (in the default [ranking](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/)). - Optional filters don't work with numeric attributes. + * + * Implementations: + * - [List] - *[OptionalFilters.of]* + * - [String] - *[OptionalFilters.of]* + */ +@Serializable(OptionalFiltersSerializer::class) +public sealed interface OptionalFilters { + @Serializable + @JvmInline + public value class ListOfOptionalFiltersValue(public val value: List) : OptionalFilters + + @Serializable + @JvmInline + public value class StringValue(public val value: String) : OptionalFilters + + public companion object { + + public fun of(value: List): OptionalFilters = ListOfOptionalFiltersValue(value) + + public fun of(value: String): OptionalFilters = StringValue(value) + } +} + +internal class OptionalFiltersSerializer : JsonContentPolymorphicSerializer(OptionalFilters::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element is JsonArray -> OptionalFilters.ListOfOptionalFiltersValue.serializer() + element.isString -> OptionalFilters.StringValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Params.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Params.kt new file mode 100644 index 00000000..b06d2553 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Params.kt @@ -0,0 +1,110 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Params + * + * @param query Search query. + * @param filters Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** ` `, where `` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `: TO ` where `` and `` are the lower and upper limits of the range (inclusive). - **Facet filters.** `:` where `` is a facet attribute (case-sensitive) and `` a facet value. - **Tag filters.** `_tags:` or just `` (case-sensitive). - **Boolean filters.** `: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/). + * @param page Page of search results to retrieve. + * @param getRankingInfo Whether the search response should include detailed ranking information. + * @param relevancyStrictness + * @param facetFilters + * @param optionalFilters + * @param numericFilters + * @param hitsPerPage Number of hits per page. + * @param aroundLatLng Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within a circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. + * @param aroundLatLngViaIP Whether to obtain the coordinates from the request's IP address. + * @param aroundRadius + * @param aroundPrecision + * @param minimumAroundRadius Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. + * @param insideBoundingBox + * @param insidePolygon Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. + * @param queryLanguages Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). + * @param naturalLanguages ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches): - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`. + * @param enableRules Whether to enable rules. + * @param ruleContexts Assigns a rule context to the search query. [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules. + * @param userToken Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). + * @param clickAnalytics Whether to include a `queryID` attribute in the response. The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/guides/sending-events/getting-started/). + * @param analytics Whether this search will be included in Analytics. + * @param analyticsTags Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + * @param enableABTest Whether to enable A/B testing for this search. + * @param enableReRanking Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. + */ +@Serializable +public data class Params( + + /** Search query. */ + @SerialName(value = "query") val query: String? = null, + + /** Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** ` `, where `` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `: TO ` where `` and `` are the lower and upper limits of the range (inclusive). - **Facet filters.** `:` where `` is a facet attribute (case-sensitive) and `` a facet value. - **Tag filters.** `_tags:` or just `` (case-sensitive). - **Boolean filters.** `: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/). */ + @SerialName(value = "filters") val filters: String? = null, + + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int? = null, + + /** Whether the search response should include detailed ranking information. */ + @SerialName(value = "getRankingInfo") val getRankingInfo: Boolean? = null, + + @SerialName(value = "relevancyStrictness") val relevancyStrictness: Int? = null, + + @SerialName(value = "facetFilters") val facetFilters: FacetFilters? = null, + + @SerialName(value = "optionalFilters") val optionalFilters: OptionalFilters? = null, + + @SerialName(value = "numericFilters") val numericFilters: NumericFilters? = null, + + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int? = null, + + /** Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within a circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. */ + @SerialName(value = "aroundLatLng") val aroundLatLng: String? = null, + + /** Whether to obtain the coordinates from the request's IP address. */ + @SerialName(value = "aroundLatLngViaIP") val aroundLatLngViaIP: Boolean? = null, + + @SerialName(value = "aroundRadius") val aroundRadius: AroundRadius? = null, + + @SerialName(value = "aroundPrecision") val aroundPrecision: AroundPrecision? = null, + + /** Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. */ + @SerialName(value = "minimumAroundRadius") val minimumAroundRadius: Int? = null, + + @SerialName(value = "insideBoundingBox") val insideBoundingBox: InsideBoundingBox? = null, + + /** Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. */ + @SerialName(value = "insidePolygon") val insidePolygon: List>? = null, + + /** Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). */ + @SerialName(value = "queryLanguages") val queryLanguages: List? = null, + + /** ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches): - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`. */ + @SerialName(value = "naturalLanguages") val naturalLanguages: List? = null, + + /** Whether to enable rules. */ + @SerialName(value = "enableRules") val enableRules: Boolean? = null, + + /** Assigns a rule context to the search query. [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules. */ + @SerialName(value = "ruleContexts") val ruleContexts: List? = null, + + /** Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). */ + @SerialName(value = "userToken") val userToken: String? = null, + + /** Whether to include a `queryID` attribute in the response. The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/guides/sending-events/getting-started/). */ + @SerialName(value = "clickAnalytics") val clickAnalytics: Boolean? = null, + + /** Whether this search will be included in Analytics. */ + @SerialName(value = "analytics") val analytics: Boolean? = null, + + /** Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). */ + @SerialName(value = "analyticsTags") val analyticsTags: List? = null, + + /** Whether to enable A/B testing for this search. */ + @SerialName(value = "enableABTest") val enableABTest: Boolean? = null, + + /** Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. */ + @SerialName(value = "enableReRanking") val enableReRanking: Boolean? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Personalization.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Personalization.kt new file mode 100644 index 00000000..a719ec46 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Personalization.kt @@ -0,0 +1,25 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Personalization + * + * @param filtersScore The score of the filters. + * @param rankingScore The score of the ranking. + * @param score The score of the event. + */ +@Serializable +public data class Personalization( + + /** The score of the filters. */ + @SerialName(value = "filtersScore") val filtersScore: Int? = null, + + /** The score of the ranking. */ + @SerialName(value = "rankingScore") val rankingScore: Int? = null, + + /** The score of the event. */ + @SerialName(value = "score") val score: Int? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Range.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Range.kt new file mode 100644 index 00000000..b518e12e --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Range.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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Range object with lower and upper values in meters to define custom ranges. + * + * @param from Lower boundary of a range in meters. The Geo ranking criterion considers all records within the range to be equal. + * @param `value` Upper boundary of a range in meters. The Geo ranking criterion considers all records within the range to be equal. + */ +@Serializable +public data class Range( + + /** Lower boundary of a range in meters. The Geo ranking criterion considers all records within the range to be equal. */ + @SerialName(value = "from") val from: Int? = null, + + /** Upper boundary of a range in meters. The Geo ranking criterion considers all records within the range to be equal. */ + @SerialName(value = "value") val `value`: Int? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Redirect.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Redirect.kt new file mode 100644 index 00000000..8d86afd7 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Redirect.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only. + * + * @param index + */ +@Serializable +public data class Redirect( + + @SerialName(value = "index") val index: List? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectRuleIndexData.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectRuleIndexData.kt new file mode 100644 index 00000000..c30ea8ef --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectRuleIndexData.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Redirect rule data. + * + * @param ruleObjectID + */ +@Serializable +public data class RedirectRuleIndexData( + + @SerialName(value = "ruleObjectID") val ruleObjectID: String, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectRuleIndexMetadata.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectRuleIndexMetadata.kt new file mode 100644 index 00000000..fa54cc86 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectRuleIndexMetadata.kt @@ -0,0 +1,32 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * RedirectRuleIndexMetadata + * + * @param source Source index for the redirect rule. + * @param dest Destination index for the redirect rule. + * @param reason Reason for the redirect rule. + * @param succeed Redirect rule status. + * @param `data` + */ +@Serializable +public data class RedirectRuleIndexMetadata( + + /** Source index for the redirect rule. */ + @SerialName(value = "source") val source: String, + + /** Destination index for the redirect rule. */ + @SerialName(value = "dest") val dest: String, + + /** Reason for the redirect rule. */ + @SerialName(value = "reason") val reason: String, + + /** Redirect rule status. */ + @SerialName(value = "succeed") val succeed: Boolean, + + @SerialName(value = "data") val `data`: RedirectRuleIndexData, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectURL.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectURL.kt new file mode 100644 index 00000000..110ced15 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RedirectURL.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * The redirect rule container. + * + * @param url + */ +@Serializable +public data class RedirectURL( + + @SerialName(value = "url") val url: String? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/RenderingContent.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RenderingContent.kt new file mode 100644 index 00000000..be081f7d --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RenderingContent.kt @@ -0,0 +1,22 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Extra data that can be used in the search UI. You can use this to control aspects of your search UI, such as the order of facet names and values without changing your frontend code. + * + * @param facetOrdering + * @param redirect + * @param widgets + */ +@Serializable +public data class RenderingContent( + + @SerialName(value = "facetOrdering") val facetOrdering: FacetOrdering? = null, + + @SerialName(value = "redirect") val redirect: RedirectURL? = null, + + @SerialName(value = "widgets") val widgets: Widgets? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/RequestBody.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RequestBody.kt new file mode 100644 index 00000000..f02b64d5 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/RequestBody.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * RequestBody + * + * @param params + */ +@Serializable +public data class RequestBody( + + @SerialName(value = "params") val params: Params? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsCompositionInfoResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsCompositionInfoResponse.kt new file mode 100644 index 00000000..7164eccf --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsCompositionInfoResponse.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * ResultsCompositionInfoResponse + * + * @param injectedItems + */ +@Serializable +public data class ResultsCompositionInfoResponse( + + @SerialName(value = "injectedItems") val injectedItems: List, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsInjectedItemAppliedRulesInfoResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsInjectedItemAppliedRulesInfoResponse.kt new file mode 100644 index 00000000..f0877276 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsInjectedItemAppliedRulesInfoResponse.kt @@ -0,0 +1,17 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * ResultsInjectedItemAppliedRulesInfoResponse + * + * @param objectID Unique record identifier. + */ +@Serializable +public data class ResultsInjectedItemAppliedRulesInfoResponse( + + /** Unique record identifier. */ + @SerialName(value = "objectID") val objectID: String, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsInjectedItemInfoResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsInjectedItemInfoResponse.kt new file mode 100644 index 00000000..cf597805 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/ResultsInjectedItemInfoResponse.kt @@ -0,0 +1,52 @@ +/** 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.composition + +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* + +/** + * ResultsInjectedItemInfoResponse + * + * @param key + * @param appliedRules + */ +@Serializable(ResultsInjectedItemInfoResponseSerializer::class) +public data class ResultsInjectedItemInfoResponse( + + val key: String, + + val appliedRules: List? = null, + + val additionalProperties: Map? = null, +) + +internal object ResultsInjectedItemInfoResponseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ResultsInjectedItemInfoResponse") { + element("key") + element>("appliedRules", isOptional = true) + } + + override fun deserialize(decoder: Decoder): ResultsInjectedItemInfoResponse { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return ResultsInjectedItemInfoResponse( + key = tree.getValue("key").let { input.json.decodeFromJsonElement(it) }, + appliedRules = tree["appliedRules"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: ResultsInjectedItemInfoResponse) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + put("key", output.json.encodeToJsonElement(value.key)) + value.appliedRules?.let { put("appliedRules", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesParams.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesParams.kt new file mode 100644 index 00000000..ea1d0bb6 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesParams.kt @@ -0,0 +1,24 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchForFacetValuesParams + * + * @param query Search query. + * @param maxFacetHits Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * @param searchQuery + */ +@Serializable +public data class SearchForFacetValuesParams( + + /** Search query. */ + @SerialName(value = "query") val query: String? = null, + + /** Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). */ + @SerialName(value = "maxFacetHits") val maxFacetHits: Int? = null, + + @SerialName(value = "searchQuery") val searchQuery: Params? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesRequest.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesRequest.kt new file mode 100644 index 00000000..064c59b7 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesRequest.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchForFacetValuesRequest + * + * @param params + */ +@Serializable +public data class SearchForFacetValuesRequest( + + @SerialName(value = "params") val params: SearchForFacetValuesParams? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesResponse.kt new file mode 100644 index 00000000..15193f94 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesResponse.kt @@ -0,0 +1,17 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchForFacetValuesResponse + * + * @param results Search for facet values results. + */ +@Serializable +public data class SearchForFacetValuesResponse( + + /** Search for facet values results. */ + @SerialName(value = "results") val results: List? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesResults.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesResults.kt new file mode 100644 index 00000000..c578787c --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchForFacetValuesResults.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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchForFacetValuesResults + * + * @param indexName + * @param facetHits Matching facet values. + * @param exhaustiveFacetsCount Whether the facet count is exhaustive (true) or approximate (false). For more information, see [Why are my facet and hit counts not accurate](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + * @param processingTimeMS Time the server took to process the request, in milliseconds. + */ +@Serializable +public data class SearchForFacetValuesResults( + + @SerialName(value = "indexName") val indexName: String, + + /** Matching facet values. */ + @SerialName(value = "facetHits") val facetHits: List, + + /** Whether the facet count is exhaustive (true) or approximate (false). For more information, see [Why are my facet and hit counts not accurate](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). */ + @SerialName(value = "exhaustiveFacetsCount") val exhaustiveFacetsCount: Boolean, + + /** Time the server took to process the request, in milliseconds. */ + @SerialName(value = "processingTimeMS") val processingTimeMS: Int? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchResponse.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchResponse.kt new file mode 100644 index 00000000..65e038c6 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchResponse.kt @@ -0,0 +1,53 @@ +/** 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.composition + +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* + +/** + * SearchResponse + * + * @param results Search results. + * @param compositions + */ +@Serializable(SearchResponseSerializer::class) +public data class SearchResponse( + + /** Search results. */ + val results: List, + + val compositions: CompositionsSearchResponse? = null, + + val additionalProperties: Map? = null, +) + +internal object SearchResponseSerializer : KSerializer { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("SearchResponse") { + element>("results") + element("compositions", isOptional = true) + } + + override fun deserialize(decoder: Decoder): SearchResponse { + val input = decoder.asJsonDecoder() + val tree = input.decodeJsonObject() + return SearchResponse( + results = tree.getValue("results").let { input.json.decodeFromJsonElement(it) }, + compositions = tree["compositions"]?.let { input.json.decodeFromJsonElement(it) }, + additionalProperties = tree.filterKeys { it !in descriptor.elementNames }, + ) + } + + override fun serialize(encoder: Encoder, value: SearchResponse) { + val output = encoder.asJsonEncoder() + val json = buildJsonObject { + put("results", output.json.encodeToJsonElement(value.results)) + value.compositions?.let { put("compositions", output.json.encodeToJsonElement(it)) } + value.additionalProperties?.onEach { (key, element) -> put(key, element) } + } + (encoder as JsonEncoder).encodeJsonElement(json) + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchResultsItem.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchResultsItem.kt new file mode 100644 index 00000000..5130ac5d --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SearchResultsItem.kt @@ -0,0 +1,148 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * SearchResultsItem + * + * @param processingTimeMS Time the server took to process the request, in milliseconds. + * @param page Page of search results to retrieve. + * @param nbHits Number of results (hits). + * @param nbPages Number of pages of results. + * @param hitsPerPage Number of hits per page. + * @param hits Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. + * @param query Search query. + * @param params URL-encoded string of all search parameters. + * @param compositions + * @param abTestID A/B test ID. This is only included in the response for indices that are part of an A/B test. + * @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test. + * @param aroundLatLng Computed geographical location. + * @param automaticRadius Distance from a central coordinate provided by `aroundLatLng`. + * @param exhaustive + * @param appliedRules Rules applied to the query. + * @param exhaustiveFacetsCount See the `facetsCount` field of the `exhaustive` object in the response. + * @param exhaustiveNbHits See the `nbHits` field of the `exhaustive` object in the response. + * @param exhaustiveTypo See the `typo` field of the `exhaustive` object in the response. + * @param facets Facet counts. + * @param facetsStats Statistics for numerical facets. + * @param index Index name used for the query. + * @param indexUsed Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + * @param message Warnings about the query. + * @param nbSortedHits Number of hits selected and sorted by the relevant sort algorithm. + * @param parsedQuery Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + * @param processingTimingsMS Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + * @param queryAfterRemoval Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + * @param redirect + * @param renderingContent + * @param serverTimeMS Time the server took to process the request, in milliseconds. + * @param serverUsed Host name of the server that processed the request. + * @param userData An object with custom data. You can store up to 32kB as custom data. + * @param queryID Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). + * @param automaticInsights Whether automatic events collection is enabled for the application. + */ +@Serializable +public data class SearchResultsItem( + + /** Time the server took to process the request, in milliseconds. */ + @SerialName(value = "processingTimeMS") val processingTimeMS: Int, + + /** Page of search results to retrieve. */ + @SerialName(value = "page") val page: Int, + + /** Number of results (hits). */ + @SerialName(value = "nbHits") val nbHits: Int, + + /** Number of pages of results. */ + @SerialName(value = "nbPages") val nbPages: Int, + + /** Number of hits per page. */ + @SerialName(value = "hitsPerPage") val hitsPerPage: Int, + + /** Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. */ + @SerialName(value = "hits") val hits: List, + + /** Search query. */ + @SerialName(value = "query") val query: String, + + /** URL-encoded string of all search parameters. */ + @SerialName(value = "params") val params: String, + + @SerialName(value = "compositions") val compositions: Map, + + /** A/B test ID. This is only included in the response for indices that are part of an A/B test. */ + @SerialName(value = "abTestID") val abTestID: Int? = null, + + /** Variant ID. This is only included in the response for indices that are part of an A/B test. */ + @SerialName(value = "abTestVariantID") val abTestVariantID: Int? = null, + + /** Computed geographical location. */ + @SerialName(value = "aroundLatLng") val aroundLatLng: String? = null, + + /** Distance from a central coordinate provided by `aroundLatLng`. */ + @SerialName(value = "automaticRadius") val automaticRadius: String? = null, + + @SerialName(value = "exhaustive") val exhaustive: Exhaustive? = null, + + /** Rules applied to the query. */ + @SerialName(value = "appliedRules") val appliedRules: List? = null, + + /** See the `facetsCount` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + @SerialName(value = "exhaustiveFacetsCount") val exhaustiveFacetsCount: Boolean? = null, + + /** See the `nbHits` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + @SerialName(value = "exhaustiveNbHits") val exhaustiveNbHits: Boolean? = null, + + /** See the `typo` field of the `exhaustive` object in the response. */ + @Deprecated(message = "This property is deprecated.") + @SerialName(value = "exhaustiveTypo") val exhaustiveTypo: Boolean? = null, + + /** Facet counts. */ + @SerialName(value = "facets") val facets: Map>? = null, + + /** Statistics for numerical facets. */ + @SerialName(value = "facets_stats") val facetsStats: Map? = null, + + /** Index name used for the query. */ + @SerialName(value = "index") val index: String? = null, + + /** Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. */ + @SerialName(value = "indexUsed") val indexUsed: String? = null, + + /** Warnings about the query. */ + @SerialName(value = "message") val message: String? = null, + + /** Number of hits selected and sorted by the relevant sort algorithm. */ + @SerialName(value = "nbSortedHits") val nbSortedHits: Int? = null, + + /** Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. */ + @SerialName(value = "parsedQuery") val parsedQuery: String? = null, + + /** Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. */ + @SerialName(value = "processingTimingsMS") val processingTimingsMS: JsonObject? = null, + + /** Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ + @SerialName(value = "queryAfterRemoval") val queryAfterRemoval: String? = null, + + @SerialName(value = "redirect") val redirect: Redirect? = null, + + @SerialName(value = "renderingContent") val renderingContent: RenderingContent? = null, + + /** Time the server took to process the request, in milliseconds. */ + @SerialName(value = "serverTimeMS") val serverTimeMS: Int? = null, + + /** Host name of the server that processed the request. */ + @SerialName(value = "serverUsed") val serverUsed: String? = null, + + /** An object with custom data. You can store up to 32kB as custom data. */ + @SerialName(value = "userData") val userData: JsonObject? = null, + + /** Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). */ + @SerialName(value = "queryID") val queryID: String? = null, + + /** Whether automatic events collection is enabled for the application. */ + @SerialName(value = "_automaticInsights") val automaticInsights: Boolean? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SnippetResult.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SnippetResult.kt new file mode 100644 index 00000000..871c0a35 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SnippetResult.kt @@ -0,0 +1,52 @@ +/** 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.composition + +import com.algolia.client.exception.AlgoliaClientException +import com.algolia.client.extensions.internal.* +import kotlinx.serialization.* +import kotlinx.serialization.builtins.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.* +import kotlinx.serialization.json.* +import kotlin.jvm.JvmInline + +/** + * SnippetResult + * + * Implementations: + * - [List] - *[SnippetResult.of]* + * - [Map] - *[SnippetResult.of]* + * - [SnippetResultOption] + */ +@Serializable(SnippetResultSerializer::class) +public sealed interface SnippetResult { + @Serializable + @JvmInline + public value class SnippetResultOptionValue(public val value: SnippetResultOption) : SnippetResult + + @Serializable + @JvmInline + public value class MapOfkotlinStringSnippetResultValue(public val value: Map) : SnippetResult + + @Serializable + @JvmInline + public value class ListOfSnippetResultValue(public val value: List) : SnippetResult + + public companion object { + + public fun of(value: SnippetResultOption): SnippetResult = SnippetResultOptionValue(value) + + public fun of(value: Map): SnippetResult = MapOfkotlinStringSnippetResultValue(value) + + public fun of(value: List): SnippetResult = ListOfSnippetResultValue(value) + } +} + +internal class SnippetResultSerializer : JsonContentPolymorphicSerializer(SnippetResult::class) { + override fun selectDeserializer(element: JsonElement): DeserializationStrategy = when { + element is JsonObject && element.containsKey("matchLevel") -> SnippetResultOption.serializer() + element is JsonObject -> SnippetResult.MapOfkotlinStringSnippetResultValue.serializer() + element is JsonArray -> SnippetResult.ListOfSnippetResultValue.serializer() + else -> throw AlgoliaClientException("Failed to deserialize json element: $element") + } +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SnippetResultOption.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SnippetResultOption.kt new file mode 100644 index 00000000..69a28592 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SnippetResultOption.kt @@ -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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Snippets that show the context around a matching search query. + * + * @param `value` Highlighted attribute value, including HTML tags. + * @param matchLevel + */ +@Serializable +public data class SnippetResultOption( + + /** Highlighted attribute value, including HTML tags. */ + @SerialName(value = "value") val `value`: String, + + @SerialName(value = "matchLevel") val matchLevel: MatchLevel, +) : SnippetResult diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SortRemainingBy.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SortRemainingBy.kt new file mode 100644 index 00000000..6891cc03 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SortRemainingBy.kt @@ -0,0 +1,22 @@ +/** 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.composition + +import kotlinx.serialization.* + +/** + * Order of facet values that aren't explicitly positioned with the `order` setting. - `count`. Order remaining facet values by decreasing count. The count is the number of matching records containing this facet value. - `alpha`. Sort facet values alphabetically. - `hidden`. Don't show facet values that aren't explicitly positioned. + */ +@Serializable +public enum class SortRemainingBy(public val value: kotlin.String) { + + @SerialName(value = "count") + Count("count"), + + @SerialName(value = "alpha") + Alpha("alpha"), + + @SerialName(value = "hidden") + Hidden("hidden"); + + override fun toString(): kotlin.String = value +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/SupportedLanguage.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SupportedLanguage.kt new file mode 100644 index 00000000..ee1e440d --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/SupportedLanguage.kt @@ -0,0 +1,217 @@ +/** 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.composition + +import kotlinx.serialization.* + +/** + * ISO code for a supported language. + */ +@Serializable +public enum class SupportedLanguage(public val value: kotlin.String) { + + @SerialName(value = "af") + Af("af"), + + @SerialName(value = "ar") + Ar("ar"), + + @SerialName(value = "az") + Az("az"), + + @SerialName(value = "bg") + Bg("bg"), + + @SerialName(value = "bn") + Bn("bn"), + + @SerialName(value = "ca") + Ca("ca"), + + @SerialName(value = "cs") + Cs("cs"), + + @SerialName(value = "cy") + Cy("cy"), + + @SerialName(value = "da") + Da("da"), + + @SerialName(value = "de") + De("de"), + + @SerialName(value = "el") + El("el"), + + @SerialName(value = "en") + En("en"), + + @SerialName(value = "eo") + Eo("eo"), + + @SerialName(value = "es") + Es("es"), + + @SerialName(value = "et") + Et("et"), + + @SerialName(value = "eu") + Eu("eu"), + + @SerialName(value = "fa") + Fa("fa"), + + @SerialName(value = "fi") + Fi("fi"), + + @SerialName(value = "fo") + Fo("fo"), + + @SerialName(value = "fr") + Fr("fr"), + + @SerialName(value = "ga") + Ga("ga"), + + @SerialName(value = "gl") + Gl("gl"), + + @SerialName(value = "he") + He("he"), + + @SerialName(value = "hi") + Hi("hi"), + + @SerialName(value = "hu") + Hu("hu"), + + @SerialName(value = "hy") + Hy("hy"), + + @SerialName(value = "id") + Id("id"), + + @SerialName(value = "is") + Is("is"), + + @SerialName(value = "it") + It("it"), + + @SerialName(value = "ja") + Ja("ja"), + + @SerialName(value = "ka") + Ka("ka"), + + @SerialName(value = "kk") + Kk("kk"), + + @SerialName(value = "ko") + Ko("ko"), + + @SerialName(value = "ku") + Ku("ku"), + + @SerialName(value = "ky") + Ky("ky"), + + @SerialName(value = "lt") + Lt("lt"), + + @SerialName(value = "lv") + Lv("lv"), + + @SerialName(value = "mi") + Mi("mi"), + + @SerialName(value = "mn") + Mn("mn"), + + @SerialName(value = "mr") + Mr("mr"), + + @SerialName(value = "ms") + Ms("ms"), + + @SerialName(value = "mt") + Mt("mt"), + + @SerialName(value = "nb") + Nb("nb"), + + @SerialName(value = "nl") + Nl("nl"), + + @SerialName(value = "no") + No("no"), + + @SerialName(value = "ns") + Ns("ns"), + + @SerialName(value = "pl") + Pl("pl"), + + @SerialName(value = "ps") + Ps("ps"), + + @SerialName(value = "pt") + Pt("pt"), + + @SerialName(value = "pt-br") + PtBr("pt-br"), + + @SerialName(value = "qu") + Qu("qu"), + + @SerialName(value = "ro") + Ro("ro"), + + @SerialName(value = "ru") + Ru("ru"), + + @SerialName(value = "sk") + Sk("sk"), + + @SerialName(value = "sq") + Sq("sq"), + + @SerialName(value = "sv") + Sv("sv"), + + @SerialName(value = "sw") + Sw("sw"), + + @SerialName(value = "ta") + Ta("ta"), + + @SerialName(value = "te") + Te("te"), + + @SerialName(value = "th") + Th("th"), + + @SerialName(value = "tl") + Tl("tl"), + + @SerialName(value = "tn") + Tn("tn"), + + @SerialName(value = "tr") + Tr("tr"), + + @SerialName(value = "tt") + Tt("tt"), + + @SerialName(value = "uk") + Uk("uk"), + + @SerialName(value = "ur") + Ur("ur"), + + @SerialName(value = "uz") + Uz("uz"), + + @SerialName(value = "zh") + Zh("zh"); + + override fun toString(): kotlin.String = value +} diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Value.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Value.kt new file mode 100644 index 00000000..0441c243 --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Value.kt @@ -0,0 +1,24 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Value + * + * @param order Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. + * @param sortRemainingBy + * @param hide Hide facet values. + */ +@Serializable +public data class Value( + + /** Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. */ + @SerialName(value = "order") val order: List? = null, + + @SerialName(value = "sortRemainingBy") val sortRemainingBy: SortRemainingBy? = null, + + /** Hide facet values. */ + @SerialName(value = "hide") val hide: List? = null, +) diff --git a/client/src/commonMain/kotlin/com/algolia/client/model/composition/Widgets.kt b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Widgets.kt new file mode 100644 index 00000000..4b2bec8f --- /dev/null +++ b/client/src/commonMain/kotlin/com/algolia/client/model/composition/Widgets.kt @@ -0,0 +1,17 @@ +/** 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.composition + +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +/** + * Widgets returned from any rules that are applied to the current search. + * + * @param banners Banners defined in the Merchandising Studio for a given search. + */ +@Serializable +public data class Widgets( + + /** Banners defined in the Merchandising Studio for a given search. */ + @SerialName(value = "banners") val banners: List? = null, +)