Android DataSource class example for repository patern.
package com.dev.data.source;
import com.dev.data.models.User;
import okhttp3.ResponseBody;
/**
* Main entry point for accessing User's data.
*/
public interface UserDataSource {
interface GetUserCallback {
void onUserLoaded(User user);
void onDataNotAvailable(Throwable err);
}
interface ResponseCallback {
void onResponseLoaded(ResponseBody responseBody);
void onResponseNotAvailable(Throwable err);
}
void getUser(GetUserCallback callback);
void saveUser( User user);
void updateUser(User user, GetUserCallback callback);
String get_id();
void set_id(String _id);
}