Skip to content

Commit 23f3218

Browse files
algolia-botFluf22
andcommitted
fix(specs): update search api specs [skip-bc] (generated)
algolia/api-clients-automation#3760 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent a9794ff commit 23f3218

File tree

6 files changed

+68
-104
lines changed

6 files changed

+68
-104
lines changed

client/src/commonMain/kotlin/com/algolia/client/model/recommend/HighlightResult.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ import kotlin.jvm.JvmInline
1515
*
1616
* Implementations:
1717
* - [HighlightResultOption]
18-
* - [List<HighlightResultOption>] - *[HighlightResult.of]*
18+
* - [List<HighlightResult>] - *[HighlightResult.of]*
1919
* - [Map<kotlin.String, HighlightResult>] - *[HighlightResult.of]*
20-
* - [Map<kotlin.String, HighlightResultOption>] - *[HighlightResult.of]*
2120
*/
2221
@Serializable(HighlightResultSerializer::class)
2322
public sealed interface HighlightResult {
@@ -27,22 +26,15 @@ public sealed interface HighlightResult {
2726

2827
@Serializable
2928
@JvmInline
30-
public value class MapOfkotlinStringHighlightResultOptionValue(public val value: Map<kotlin.String, HighlightResultOption>) : HighlightResult
31-
32-
@Serializable
33-
@JvmInline
34-
public value class ListOfHighlightResultOptionValue(public val value: List<HighlightResultOption>) : HighlightResult
29+
public value class ListOfHighlightResultValue(public val value: List<HighlightResult>) : HighlightResult
3530

3631
public companion object {
3732

38-
public fun ofMapOfkotlinStringHighlightResult(value: Map<kotlin.String, HighlightResult>): HighlightResult {
33+
public fun of(value: Map<kotlin.String, HighlightResult>): HighlightResult {
3934
return MapOfkotlinStringHighlightResultValue(value)
4035
}
41-
public fun ofMapOfkotlinStringHighlightResultOption(value: Map<kotlin.String, HighlightResultOption>): HighlightResult {
42-
return MapOfkotlinStringHighlightResultOptionValue(value)
43-
}
44-
public fun of(value: List<HighlightResultOption>): HighlightResult {
45-
return ListOfHighlightResultOptionValue(value)
36+
public fun of(value: List<HighlightResult>): HighlightResult {
37+
return ListOfHighlightResultValue(value)
4638
}
4739
}
4840
}
@@ -52,8 +44,7 @@ internal class HighlightResultSerializer : JsonContentPolymorphicSerializer<High
5244
return when {
5345
element is JsonObject && element.containsKey("matchLevel") && element.containsKey("matchedWords") -> HighlightResultOption.serializer()
5446
element is JsonObject -> HighlightResult.MapOfkotlinStringHighlightResultValue.serializer()
55-
element is JsonObject -> HighlightResult.MapOfkotlinStringHighlightResultOptionValue.serializer()
56-
element.isJsonArrayOfObjects -> HighlightResult.ListOfHighlightResultOptionValue.serializer()
47+
element.isJsonArrayOfObjects -> HighlightResult.ListOfHighlightResultValue.serializer()
5748
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
5849
}
5950
}

client/src/commonMain/kotlin/com/algolia/client/model/recommend/RecommendationsResults.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import kotlinx.serialization.json.*
88
* RecommendationsResults
99
*
1010
* @param processingTimeMS Time the server took to process the request, in milliseconds.
11-
* @param page Page of search results to retrieve.
12-
* @param nbHits Number of results (hits).
13-
* @param nbPages Number of pages of results.
14-
* @param hitsPerPage Number of hits per page.
1511
* @param hits
1612
* @param abTestID A/B test ID. This is only included in the response for indices that are part of an A/B test.
1713
* @param abTestVariantID Variant ID. This is only included in the response for indices that are part of an A/B test.
@@ -37,25 +33,17 @@ import kotlinx.serialization.json.*
3733
* @param userData An object with custom data. You can store up to 32kB as custom data.
3834
* @param queryID Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
3935
* @param automaticInsights Whether automatic events collection is enabled for the application.
36+
* @param page Page of search results to retrieve.
37+
* @param nbHits Number of results (hits).
38+
* @param nbPages Number of pages of results.
39+
* @param hitsPerPage Number of hits per page.
4040
*/
4141
@Serializable
4242
public data class RecommendationsResults(
4343

4444
/** Time the server took to process the request, in milliseconds. */
4545
@SerialName(value = "processingTimeMS") val processingTimeMS: Int,
4646

47-
/** Page of search results to retrieve. */
48-
@SerialName(value = "page") val page: Int,
49-
50-
/** Number of results (hits). */
51-
@SerialName(value = "nbHits") val nbHits: Int,
52-
53-
/** Number of pages of results. */
54-
@SerialName(value = "nbPages") val nbPages: Int,
55-
56-
/** Number of hits per page. */
57-
@SerialName(value = "hitsPerPage") val hitsPerPage: Int,
58-
5947
@SerialName(value = "hits") val hits: List<RecommendationsHit>,
6048

6149
/** A/B test ID. This is only included in the response for indices that are part of an A/B test. */
@@ -129,4 +117,16 @@ public data class RecommendationsResults(
129117

130118
/** Whether automatic events collection is enabled for the application. */
131119
@SerialName(value = "_automaticInsights") val automaticInsights: Boolean? = null,
120+
121+
/** Page of search results to retrieve. */
122+
@SerialName(value = "page") val page: Int? = null,
123+
124+
/** Number of results (hits). */
125+
@SerialName(value = "nbHits") val nbHits: Int? = null,
126+
127+
/** Number of pages of results. */
128+
@SerialName(value = "nbPages") val nbPages: Int? = null,
129+
130+
/** Number of hits per page. */
131+
@SerialName(value = "hitsPerPage") val hitsPerPage: Int? = null,
132132
)

client/src/commonMain/kotlin/com/algolia/client/model/recommend/SnippetResult.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ import kotlin.jvm.JvmInline
1414
* SnippetResult
1515
*
1616
* Implementations:
17-
* - [List<SnippetResultOption>] - *[SnippetResult.of]*
17+
* - [List<SnippetResult>] - *[SnippetResult.of]*
1818
* - [Map<kotlin.String, SnippetResult>] - *[SnippetResult.of]*
19-
* - [Map<kotlin.String, SnippetResultOption>] - *[SnippetResult.of]*
2019
* - [SnippetResultOption]
2120
*/
2221
@Serializable(SnippetResultSerializer::class)
@@ -27,22 +26,15 @@ public sealed interface SnippetResult {
2726

2827
@Serializable
2928
@JvmInline
30-
public value class MapOfkotlinStringSnippetResultOptionValue(public val value: Map<kotlin.String, SnippetResultOption>) : SnippetResult
31-
32-
@Serializable
33-
@JvmInline
34-
public value class ListOfSnippetResultOptionValue(public val value: List<SnippetResultOption>) : SnippetResult
29+
public value class ListOfSnippetResultValue(public val value: List<SnippetResult>) : SnippetResult
3530

3631
public companion object {
3732

38-
public fun ofMapOfkotlinStringSnippetResult(value: Map<kotlin.String, SnippetResult>): SnippetResult {
33+
public fun of(value: Map<kotlin.String, SnippetResult>): SnippetResult {
3934
return MapOfkotlinStringSnippetResultValue(value)
4035
}
41-
public fun ofMapOfkotlinStringSnippetResultOption(value: Map<kotlin.String, SnippetResultOption>): SnippetResult {
42-
return MapOfkotlinStringSnippetResultOptionValue(value)
43-
}
44-
public fun of(value: List<SnippetResultOption>): SnippetResult {
45-
return ListOfSnippetResultOptionValue(value)
36+
public fun of(value: List<SnippetResult>): SnippetResult {
37+
return ListOfSnippetResultValue(value)
4638
}
4739
}
4840
}
@@ -52,8 +44,7 @@ internal class SnippetResultSerializer : JsonContentPolymorphicSerializer<Snippe
5244
return when {
5345
element is JsonObject && element.containsKey("matchLevel") -> SnippetResultOption.serializer()
5446
element is JsonObject -> SnippetResult.MapOfkotlinStringSnippetResultValue.serializer()
55-
element is JsonObject -> SnippetResult.MapOfkotlinStringSnippetResultOptionValue.serializer()
56-
element.isJsonArrayOfObjects -> SnippetResult.ListOfSnippetResultOptionValue.serializer()
47+
element.isJsonArrayOfObjects -> SnippetResult.ListOfSnippetResultValue.serializer()
5748
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
5849
}
5950
}

client/src/commonMain/kotlin/com/algolia/client/model/search/HighlightResult.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ import kotlin.jvm.JvmInline
1515
*
1616
* Implementations:
1717
* - [HighlightResultOption]
18-
* - [List<HighlightResultOption>] - *[HighlightResult.of]*
18+
* - [List<HighlightResult>] - *[HighlightResult.of]*
1919
* - [Map<kotlin.String, HighlightResult>] - *[HighlightResult.of]*
20-
* - [Map<kotlin.String, HighlightResultOption>] - *[HighlightResult.of]*
2120
*/
2221
@Serializable(HighlightResultSerializer::class)
2322
public sealed interface HighlightResult {
@@ -27,22 +26,15 @@ public sealed interface HighlightResult {
2726

2827
@Serializable
2928
@JvmInline
30-
public value class MapOfkotlinStringHighlightResultOptionValue(public val value: Map<kotlin.String, HighlightResultOption>) : HighlightResult
31-
32-
@Serializable
33-
@JvmInline
34-
public value class ListOfHighlightResultOptionValue(public val value: List<HighlightResultOption>) : HighlightResult
29+
public value class ListOfHighlightResultValue(public val value: List<HighlightResult>) : HighlightResult
3530

3631
public companion object {
3732

38-
public fun ofMapOfkotlinStringHighlightResult(value: Map<kotlin.String, HighlightResult>): HighlightResult {
33+
public fun of(value: Map<kotlin.String, HighlightResult>): HighlightResult {
3934
return MapOfkotlinStringHighlightResultValue(value)
4035
}
41-
public fun ofMapOfkotlinStringHighlightResultOption(value: Map<kotlin.String, HighlightResultOption>): HighlightResult {
42-
return MapOfkotlinStringHighlightResultOptionValue(value)
43-
}
44-
public fun of(value: List<HighlightResultOption>): HighlightResult {
45-
return ListOfHighlightResultOptionValue(value)
36+
public fun of(value: List<HighlightResult>): HighlightResult {
37+
return ListOfHighlightResultValue(value)
4638
}
4739
}
4840
}
@@ -52,8 +44,7 @@ internal class HighlightResultSerializer : JsonContentPolymorphicSerializer<High
5244
return when {
5345
element is JsonObject && element.containsKey("matchLevel") && element.containsKey("matchedWords") -> HighlightResultOption.serializer()
5446
element is JsonObject -> HighlightResult.MapOfkotlinStringHighlightResultValue.serializer()
55-
element is JsonObject -> HighlightResult.MapOfkotlinStringHighlightResultOptionValue.serializer()
56-
element.isJsonArrayOfObjects -> HighlightResult.ListOfHighlightResultOptionValue.serializer()
47+
element.isJsonArrayOfObjects -> HighlightResult.ListOfHighlightResultValue.serializer()
5748
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
5849
}
5950
}

client/src/commonMain/kotlin/com/algolia/client/model/search/SearchResponse.kt

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import kotlinx.serialization.json.*
1111
* SearchResponse
1212
*
1313
* @param processingTimeMS Time the server took to process the request, in milliseconds.
14-
* @param page Page of search results to retrieve.
15-
* @param nbHits Number of results (hits).
16-
* @param nbPages Number of pages of results.
17-
* @param hitsPerPage Number of hits per page.
1814
* @param hits Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
1915
* @param query Search query.
2016
* @param params URL-encoded string of all search parameters.
@@ -42,25 +38,17 @@ import kotlinx.serialization.json.*
4238
* @param userData An object with custom data. You can store up to 32kB as custom data.
4339
* @param queryID Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
4440
* @param automaticInsights Whether automatic events collection is enabled for the application.
41+
* @param page Page of search results to retrieve.
42+
* @param nbHits Number of results (hits).
43+
* @param nbPages Number of pages of results.
44+
* @param hitsPerPage Number of hits per page.
4545
*/
4646
@Serializable(SearchResponseSerializer::class)
4747
public data class SearchResponse(
4848

4949
/** Time the server took to process the request, in milliseconds. */
5050
val processingTimeMS: Int,
5151

52-
/** Page of search results to retrieve. */
53-
val page: Int,
54-
55-
/** Number of results (hits). */
56-
val nbHits: Int,
57-
58-
/** Number of pages of results. */
59-
val nbPages: Int,
60-
61-
/** Number of hits per page. */
62-
val hitsPerPage: Int,
63-
6452
/** Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. */
6553
val hits: List<Hit>,
6654

@@ -142,17 +130,25 @@ public data class SearchResponse(
142130
/** Whether automatic events collection is enabled for the application. */
143131
val automaticInsights: Boolean? = null,
144132

133+
/** Page of search results to retrieve. */
134+
val page: Int? = null,
135+
136+
/** Number of results (hits). */
137+
val nbHits: Int? = null,
138+
139+
/** Number of pages of results. */
140+
val nbPages: Int? = null,
141+
142+
/** Number of hits per page. */
143+
val hitsPerPage: Int? = null,
144+
145145
val additionalProperties: Map<String, JsonElement>? = null,
146146
) : SearchResult
147147

148148
internal object SearchResponseSerializer : KSerializer<SearchResponse> {
149149

150150
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("SearchResponse") {
151151
element<Int>("processingTimeMS")
152-
element<Int>("page")
153-
element<Int>("nbHits")
154-
element<Int>("nbPages")
155-
element<Int>("hitsPerPage")
156152
element<List<Hit>>("hits")
157153
element<String>("query")
158154
element<String>("params")
@@ -180,17 +176,17 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
180176
element<JsonObject>("userData", isOptional = true)
181177
element<String>("queryID", isOptional = true)
182178
element<Boolean>("_automaticInsights", isOptional = true)
179+
element<Int>("page", isOptional = true)
180+
element<Int>("nbHits", isOptional = true)
181+
element<Int>("nbPages", isOptional = true)
182+
element<Int>("hitsPerPage", isOptional = true)
183183
}
184184

185185
override fun deserialize(decoder: Decoder): SearchResponse {
186186
val input = decoder.asJsonDecoder()
187187
val tree = input.decodeJsonObject()
188188
return SearchResponse(
189189
processingTimeMS = tree.getValue("processingTimeMS").let { input.json.decodeFromJsonElement(it) },
190-
page = tree.getValue("page").let { input.json.decodeFromJsonElement(it) },
191-
nbHits = tree.getValue("nbHits").let { input.json.decodeFromJsonElement(it) },
192-
nbPages = tree.getValue("nbPages").let { input.json.decodeFromJsonElement(it) },
193-
hitsPerPage = tree.getValue("hitsPerPage").let { input.json.decodeFromJsonElement(it) },
194190
hits = tree.getValue("hits").let { input.json.decodeFromJsonElement(it) },
195191
query = tree.getValue("query").let { input.json.decodeFromJsonElement(it) },
196192
params = tree.getValue("params").let { input.json.decodeFromJsonElement(it) },
@@ -218,6 +214,10 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
218214
userData = tree["userData"]?.let { input.json.decodeFromJsonElement(it) },
219215
queryID = tree["queryID"]?.let { input.json.decodeFromJsonElement(it) },
220216
automaticInsights = tree["_automaticInsights"]?.let { input.json.decodeFromJsonElement(it) },
217+
page = tree["page"]?.let { input.json.decodeFromJsonElement(it) },
218+
nbHits = tree["nbHits"]?.let { input.json.decodeFromJsonElement(it) },
219+
nbPages = tree["nbPages"]?.let { input.json.decodeFromJsonElement(it) },
220+
hitsPerPage = tree["hitsPerPage"]?.let { input.json.decodeFromJsonElement(it) },
221221
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
222222
)
223223
}
@@ -226,10 +226,6 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
226226
val output = encoder.asJsonEncoder()
227227
val json = buildJsonObject {
228228
put("processingTimeMS", output.json.encodeToJsonElement(value.processingTimeMS))
229-
put("page", output.json.encodeToJsonElement(value.page))
230-
put("nbHits", output.json.encodeToJsonElement(value.nbHits))
231-
put("nbPages", output.json.encodeToJsonElement(value.nbPages))
232-
put("hitsPerPage", output.json.encodeToJsonElement(value.hitsPerPage))
233229
put("hits", output.json.encodeToJsonElement(value.hits))
234230
put("query", output.json.encodeToJsonElement(value.query))
235231
put("params", output.json.encodeToJsonElement(value.params))
@@ -257,6 +253,10 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
257253
value.userData?.let { put("userData", output.json.encodeToJsonElement(it)) }
258254
value.queryID?.let { put("queryID", output.json.encodeToJsonElement(it)) }
259255
value.automaticInsights?.let { put("_automaticInsights", output.json.encodeToJsonElement(it)) }
256+
value.page?.let { put("page", output.json.encodeToJsonElement(it)) }
257+
value.nbHits?.let { put("nbHits", output.json.encodeToJsonElement(it)) }
258+
value.nbPages?.let { put("nbPages", output.json.encodeToJsonElement(it)) }
259+
value.hitsPerPage?.let { put("hitsPerPage", output.json.encodeToJsonElement(it)) }
260260
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
261261
}
262262
(encoder as JsonEncoder).encodeJsonElement(json)

client/src/commonMain/kotlin/com/algolia/client/model/search/SnippetResult.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ import kotlin.jvm.JvmInline
1414
* SnippetResult
1515
*
1616
* Implementations:
17-
* - [List<SnippetResultOption>] - *[SnippetResult.of]*
17+
* - [List<SnippetResult>] - *[SnippetResult.of]*
1818
* - [Map<kotlin.String, SnippetResult>] - *[SnippetResult.of]*
19-
* - [Map<kotlin.String, SnippetResultOption>] - *[SnippetResult.of]*
2019
* - [SnippetResultOption]
2120
*/
2221
@Serializable(SnippetResultSerializer::class)
@@ -27,22 +26,15 @@ public sealed interface SnippetResult {
2726

2827
@Serializable
2928
@JvmInline
30-
public value class MapOfkotlinStringSnippetResultOptionValue(public val value: Map<kotlin.String, SnippetResultOption>) : SnippetResult
31-
32-
@Serializable
33-
@JvmInline
34-
public value class ListOfSnippetResultOptionValue(public val value: List<SnippetResultOption>) : SnippetResult
29+
public value class ListOfSnippetResultValue(public val value: List<SnippetResult>) : SnippetResult
3530

3631
public companion object {
3732

38-
public fun ofMapOfkotlinStringSnippetResult(value: Map<kotlin.String, SnippetResult>): SnippetResult {
33+
public fun of(value: Map<kotlin.String, SnippetResult>): SnippetResult {
3934
return MapOfkotlinStringSnippetResultValue(value)
4035
}
41-
public fun ofMapOfkotlinStringSnippetResultOption(value: Map<kotlin.String, SnippetResultOption>): SnippetResult {
42-
return MapOfkotlinStringSnippetResultOptionValue(value)
43-
}
44-
public fun of(value: List<SnippetResultOption>): SnippetResult {
45-
return ListOfSnippetResultOptionValue(value)
36+
public fun of(value: List<SnippetResult>): SnippetResult {
37+
return ListOfSnippetResultValue(value)
4638
}
4739
}
4840
}
@@ -52,8 +44,7 @@ internal class SnippetResultSerializer : JsonContentPolymorphicSerializer<Snippe
5244
return when {
5345
element is JsonObject && element.containsKey("matchLevel") -> SnippetResultOption.serializer()
5446
element is JsonObject -> SnippetResult.MapOfkotlinStringSnippetResultValue.serializer()
55-
element is JsonObject -> SnippetResult.MapOfkotlinStringSnippetResultOptionValue.serializer()
56-
element.isJsonArrayOfObjects -> SnippetResult.ListOfSnippetResultOptionValue.serializer()
47+
element.isJsonArrayOfObjects -> SnippetResult.ListOfSnippetResultValue.serializer()
5748
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
5849
}
5950
}

0 commit comments

Comments
 (0)