Skip to content

Instantly share code, notes, and snippets.

@b00sti
Created April 28, 2017 14:29
Show Gist options
  • Save b00sti/ff0e2154e70175c0d6f648291b32a1d5 to your computer and use it in GitHub Desktop.
Save b00sti/ff0e2154e70175c0d6f648291b32a1d5 to your computer and use it in GitHub Desktop.
public static Observable<User> getFromApi(String username) {
Retrofit retrofit = new Retrofit.Builder()
.addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()))
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(ENDPOINT)
.build();
UserService apiService = retrofit.create(UserService.class);
return apiService.getUser(username);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment