
main.retrofit2.converter.kotlinx.serialization.SerializationStrategyConverter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of converter-kotlinx-serialization Show documentation
Show all versions of converter-kotlinx-serialization Show documentation
A Retrofit Converter which uses kotlinx.serialization for serialization.
package retrofit2.converter.kotlinx.serialization
import kotlinx.serialization.SerializationStrategy
import okhttp3.MediaType
import okhttp3.RequestBody
import retrofit2.Converter
internal class SerializationStrategyConverter(
private val contentType: MediaType,
private val saver: SerializationStrategy,
private val serializer: Serializer
) : Converter {
override fun convert(value: T) = serializer.toRequestBody(contentType, saver, value)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy