Retrofit 2 Synchronous Adapter

Additional

Language
Java
Version
N/A
Created
Mar 5, 2017
Updated
Jul 11, 2017
Owner
Jared Burrows (jaredsburrows)
Contributor
Jared Burrows (jaredsburrows)
1
Activity
Badge
Generate
Download
Source code

Announcement

Retrofit 2 Synchronous Adapter

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:retrofit2-synchronous-adapter:0.3.0"

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