Skip to content

Instantly share code, notes, and snippets.

@julianfalcionelli
Created November 29, 2017 19:33
Show Gist options
  • Save julianfalcionelli/bb31d4c00b0a669346c7461ff0916483 to your computer and use it in GitHub Desktop.
Save julianfalcionelli/bb31d4c00b0a669346c7461ff0916483 to your computer and use it in GitHub Desktop.
ExampleNetwork
// -------
private IExampleNetwork mIExampleNetwork, mICachedExampleNetwork;
ExampleNetwork(RetrofitManager retrofitManager) {
mIExampleNetwork = retrofitManager.getRetrofit().create(IExampleNetwork.class);
mICachedExampleNetwork = retrofitManager.getCachedRetrofit().create(IExampleNetwork.class);
}
interface IExampleNetwork {
@GET("/api/details")
Single<Details> getDetails(@Query("id") String id);
}
@Override
public Single<Details> getDetails(String id) {
return mIExampleNetwork.getDetails(id);
}
@Override
public Single<Details> getCachedDetails(String id) {
return mICachedExampleNetwork.getDetails(id);
}
// -------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment