Retrofit 2 Kotlin Coroutine Adapter

A CallAdapter.Factory for Kotlin coroutine's Deferred.

Лицензия

Лицензия

Категории

Категории

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

Группа

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

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

retrofit2-kotlin-coroutines-adapter
Последняя версия

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

0.9.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

Retrofit 2 Kotlin Coroutine Adapter
A CallAdapter.Factory for Kotlin coroutine's Deferred.
Ссылка на сайт

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

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

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

https://github.com/JakeWharton/retrofit2-kotlin-coroutines-adapter/

Скачать retrofit2-kotlin-coroutines-adapter

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

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

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.squareup.retrofit2 : retrofit jar 2.4.0
org.jetbrains.kotlin : kotlin-stdlib jar 1.3.0-rc-57
org.jetbrains.kotlinx : kotlinx-coroutines-core jar 0.26.1-eap13

test (4)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
com.squareup.okhttp3 : mockwebserver jar 3.11.0
com.google.guava : guava jar 26.0-jre
com.google.truth : truth jar 0.42

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

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

Kotlin Coroutine Adapter (DEPRECATED)

A Retrofit 2 CallAdapter.Factory for Kotlin coroutine's Deferred.

This library is deprecated. Please migrate to Retrofit 2.6.0 or newer and its built-in suspend support

Usage

Add CoroutineCallAdapterFactory as a Call adapter when building your Retrofit instance:

val retrofit = Retrofit.Builder()
    .baseUrl("https://example.com/")
    .addCallAdapterFactory(CoroutineCallAdapterFactory())
    .build()

Your service methods can now use Deferred as their return type.

interface MyService {
  @GET("/user")
  fun getUser(): Deferred<User>

  // or

  @GET("/user")
  fun getUser(): Deferred<Response<User>>
}

Download

If you are using Kotlin 1.3, download the latest JAR or grab via Maven:

<dependency>
  <groupId>com.jakewharton.retrofit</groupId>
  <artifactId>retrofit2-kotlin-coroutines-adapter</artifactId>
  <version>0.9.2</version>
</dependency>

or Gradle:

implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

If you are using Kotlin pre-1.3 and experimental coroutines, download its latest JAR or grab via Maven:

<dependency>
  <groupId>com.jakewharton.retrofit</groupId>
  <artifactId>retrofit2-kotlin-coroutines-experimental-adapter</artifactId>
  <version>1.0.0</version>
</dependency>

or Gradle:

implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-experimental-adapter:1.0.0'

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

License

Copyright 2017 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.9.2
0.9.1
0.9.0