retrofit2-synchronous-adapter

简介:This adapter allows synchronous return types for Retrofit 2.
更多:作者   提 Bug   
标签:

License Build Status Coverage Status Twitter Follow

A synchronous CallAdapter.Factory implementation for Retrofit 2.

This project brings Retrofit 1's synchronous usage to Retrofit 2.

Usage

// Setup retrofit
Retrofit retrofit = new Retrofit.Builder()
  .baseUrl("https://api.example.com")
  .addCallAdapterFactory(SynchronousCallAdapterFactory.create())
  .build();

// Create your service
interface Service {
  @GET("/") String string();
}

// Initiate the service
Service example = retrofit.create(Service.class);

// Make your HTTP request
String response = example.string();

Download

Gradle:

repositories {
  jcenter()
}

compile "com.jaredsburrows.retrofit:adapter-synchronous:0.1.4"

Snapshot versions are available in the JFrog Artifactory repository: https://oss.jfrog.org/webapp/#/builds/adapter-synchronous

Android 开发经验分享
用了一年多的理财推荐
Android 开发经验分享
用了一年多的理财推荐