Retrofit 2 Kotlin Serialization Converter

A Converter.Factory for Kotlin's serialization support.

Лицензия

Лицензия

Категории

Категории

Kotlin Языки программирования Retrofit Сеть HTTP Clients Serialization Данные Data Formats
Группа

Группа

com.jakewharton.retrofit
Идентификатор

Идентификатор

retrofit2-kotlinx-serialization-converter
Последняя версия

Последняя версия

0.8.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Retrofit 2 Kotlin Serialization Converter
A Converter.Factory for Kotlin's serialization support.
Ссылка на сайт

Ссылка на сайт

https://github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/
Система контроля версий

Система контроля версий

https://github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/

Скачать retrofit2-kotlinx-serialization-converter

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.jakewharton.retrofit/retrofit2-kotlinx-serialization-converter/ -->
<dependency>
    <groupId>com.jakewharton.retrofit</groupId>
    <artifactId>retrofit2-kotlinx-serialization-converter</artifactId>
    <version>0.8.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.jakewharton.retrofit/retrofit2-kotlinx-serialization-converter/
implementation 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0'
// https://jarcasting.com/artifacts/com.jakewharton.retrofit/retrofit2-kotlinx-serialization-converter/
implementation ("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")
'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:jar:0.8.0'
<dependency org="com.jakewharton.retrofit" name="retrofit2-kotlinx-serialization-converter" rev="0.8.0">
  <artifact name="retrofit2-kotlinx-serialization-converter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.jakewharton.retrofit', module='retrofit2-kotlinx-serialization-converter', version='0.8.0')
)
libraryDependencies += "com.jakewharton.retrofit" % "retrofit2-kotlinx-serialization-converter" % "0.8.0"
[com.jakewharton.retrofit/retrofit2-kotlinx-serialization-converter "0.8.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.squareup.retrofit2 : retrofit jar 2.6.4
org.jetbrains.kotlinx : kotlinx-serialization-core-jvm jar 1.0.0
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.10

test (5)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13
com.squareup.okhttp3 : mockwebserver jar 3.14.7
com.google.truth : truth jar 1.0.1
org.jetbrains.kotlinx : kotlinx-serialization-protobuf jar 1.0.0
org.jetbrains.kotlinx : kotlinx-serialization-json jar 1.0.0

Модули Проекта

Данный проект не имеет модулей.

Kotlin Serialization Converter

A Retrofit 2 Converter.Factory for Kotlin serialization.

Usage

Add a converter factory when building your Retrofit instance using the asConverterFactory extension function:

val contentType = "application/json".toMediaType()
val retrofit = Retrofit.Builder()
    .baseUrl("https://example.com/")
    .addConverterFactory(Json.asConverterFactory(contentType))
    .build()

Response body types (e.g., Call<User>) and @Body types (e.g., @Body user: User) will now use the supplied serializer.

Because Kotlin serialization is so flexible in the types it supports, these converters assume that they can handle all types. If you are mixing this converter with another, you must add this instance last to allow the other converters a chance to see their types.

Download

Download the latest JAR or grab via Gradle:

implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")

or Maven:

<dependency>
  <groupId>com.jakewharton.retrofit</groupId>
  <artifactId>retrofit2-kotlinx-serialization-converter</artifactId>
  <version>0.8.0</version>
</dependency>

Snapshots of the development version are available in Sonatype's snapshots repository.

License

Copyright 2018 Jake Wharton

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Версии библиотеки

Версия
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.0
0.0.1