File tree Expand file tree Collapse file tree 5 files changed +12
-17
lines changed
client/src/commonMain/kotlin/com/algolia/search Expand file tree Collapse file tree 5 files changed +12
-17
lines changed Original file line number Diff line number Diff line change 11# Unreleased
22
3+ ### Fixed
4+ - Answers: use UTF8 encoded index name (#269 )
5+
36### Changed
47- ` ClientRecommendation ` renamed to ` ClientPersonalization ` (#267 )
58- Update Kotlin to 1.5.20
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ internal class EndpointAnswersImpl(
2424 return transport.request(
2525 httpMethod = HttpMethod .Post ,
2626 callType = CallType .Read ,
27- path = " 1/answers/${indexName.raw } /prediction" ,
27+ path = " 1/answers/${indexName.encode() } /prediction" ,
2828 requestOptions = requestOptions,
2929 body = body
3030 )
Original file line number Diff line number Diff line change 11package com.algolia.search.helper.internal
22
3- internal class StringUTF8 private constructor(val string : String ) {
4-
5- public companion object {
6-
7- fun encode (string : String ) = StringUTF8 (string.encodeUTF8())
8- }
9- }
10-
113internal expect fun String.encodeUTF8 (): String
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.algolia.search.model
22
33import com.algolia.search.client.Index
44import com.algolia.search.exception.EmptyStringException
5- import com.algolia.search.helper.internal.StringUTF8
5+ import com.algolia.search.helper.internal.encodeUTF8
66import com.algolia.search.helper.toIndexName
77import com.algolia.search.model.internal.Raw
88import com.algolia.search.serialize.RouteIndexesV1
@@ -25,12 +25,12 @@ public data class IndexName(
2525 if (raw.isBlank()) throw EmptyStringException (" IndexName" )
2626 }
2727
28- private fun encode (): StringUTF8 {
29- return StringUTF8 .encode(raw )
28+ internal fun encode (): String {
29+ return raw.encodeUTF8( )
3030 }
3131
3232 internal fun toPath (suffix : String? = null): String {
33- return " $RouteIndexesV1 /${encode().string } " + (suffix ? : " " )
33+ return " $RouteIndexesV1 /${encode()} " + (suffix ? : " " )
3434 }
3535
3636 override fun toString (): String {
Original file line number Diff line number Diff line change 11package com.algolia.search.model.dictionary
22
3- import com.algolia.search.helper.internal.StringUTF8
3+ import com.algolia.search.helper.internal.encodeUTF8
44import com.algolia.search.model.dictionary.DictionaryEntry.Compound
55import com.algolia.search.model.dictionary.DictionaryEntry.Plural
66import com.algolia.search.model.dictionary.DictionaryEntry.Stopword
@@ -28,12 +28,12 @@ public sealed class Dictionary<T : DictionaryEntry>(
2828 @Serializable
2929 public object Compounds : Dictionary<Compound>(KeyCompounds )
3030
31- private fun encode (): StringUTF8 {
32- return StringUTF8 .encode(raw )
31+ private fun encode (): String {
32+ return raw.encodeUTF8( )
3333 }
3434
3535 internal fun toPath (suffix : String? = null): String {
36- return " $RouteDictionaries /${encode().string } " + (suffix ? : " " )
36+ return " $RouteDictionaries /${encode()} " + (suffix ? : " " )
3737 }
3838
3939 override fun toString (): String {
You can’t perform that action at this time.
0 commit comments