@@ -41,6 +41,7 @@ import kotlinx.serialization.json.*
41
41
* @param serverUsed Host name of the server that processed the request.
42
42
* @param userData An object with custom data. You can store up to 32kB as custom data.
43
43
* @param queryID Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
44
+ * @param automaticInsights Whether automatic events collection is enabled for the application.
44
45
*/
45
46
@Serializable(SearchResponseSerializer ::class )
46
47
public data class SearchResponse (
@@ -138,6 +139,9 @@ public data class SearchResponse(
138
139
/* * Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). */
139
140
val queryID : String? = null ,
140
141
142
+ /* * Whether automatic events collection is enabled for the application. */
143
+ val automaticInsights : Boolean? = null ,
144
+
141
145
val additionalProperties : Map <String , JsonElement >? = null ,
142
146
) : SearchResult
143
147
@@ -175,6 +179,7 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
175
179
element<String >(" serverUsed" , isOptional = true )
176
180
element<JsonObject >(" userData" , isOptional = true )
177
181
element<String >(" queryID" , isOptional = true )
182
+ element<Boolean >(" _automaticInsights" , isOptional = true )
178
183
}
179
184
180
185
override fun deserialize (decoder : Decoder ): SearchResponse {
@@ -212,6 +217,7 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
212
217
serverUsed = tree[" serverUsed" ]?.let { input.json.decodeFromJsonElement(it) },
213
218
userData = tree[" userData" ]?.let { input.json.decodeFromJsonElement(it) },
214
219
queryID = tree[" queryID" ]?.let { input.json.decodeFromJsonElement(it) },
220
+ automaticInsights = tree[" _automaticInsights" ]?.let { input.json.decodeFromJsonElement(it) },
215
221
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
216
222
)
217
223
}
@@ -250,6 +256,7 @@ internal object SearchResponseSerializer : KSerializer<SearchResponse> {
250
256
value.serverUsed?.let { put(" serverUsed" , output.json.encodeToJsonElement(it)) }
251
257
value.userData?.let { put(" userData" , output.json.encodeToJsonElement(it)) }
252
258
value.queryID?.let { put(" queryID" , output.json.encodeToJsonElement(it)) }
259
+ value.automaticInsights?.let { put(" _automaticInsights" , output.json.encodeToJsonElement(it)) }
253
260
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
254
261
}
255
262
(encoder as JsonEncoder ).encodeJsonElement(json)
0 commit comments