package de.fau.amos.virtualledger.android.api.contacts;

import java.util.List;

import de.fau.amos.virtualledger.android.api.RestApi;
import de.fau.amos.virtualledger.android.api.shared.CallWithToken;
import de.fau.amos.virtualledger.android.api.shared.RetrofitCallback;
import de.fau.amos.virtualledger.android.api.shared.TokenCallback;
import de.fau.amos.virtualledger.dtos.Contact;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;

/**
 * Created by Simon on 01.07.2017.
 */

public class HTTPContactsProvider implements ContactsProvider{

    private static final String TAG = "HTTPContactsProvider";

    private RestApi restApi;
    private CallWithToken callWithToken;

    public HTTPContactsProvider(RestApi restApi, final CallWithToken callWithToken) {
        this.restApi = restApi;
        this.callWithToken = callWithToken;
    }

    @Override
    public Observable<List<Contact>> getContacts() {

        final PublishSubject<List<Contact>> observable = PublishSubject.create();

        callWithToken.callWithToken(observable, new TokenCallback() {
            @Override
            public void onReceiveToken(final String token) {
                // got token
                restApi.getContacts(token).enqueue(new RetrofitCallback<>(observable));
            }
        });

        return observable;
    }


    @Override
    public Observable<Void> addContacts(Contact savingsAccount) {
        return null;
    }
}

@@ -128,16 +128,90 @@
 estApi;%0A
+import de.fau.amos.virtualledger.android.api.banking.HTTPBankingProvider;%0A
 import d
@@ -535,52 +535,8 @@
 t;%0A%0A
-/**%0A * Created by Simon on 01.07.2017.%0A */%0A%0A
 publ
@@ -595,16 +595,48 @@
 vider%7B%0A%0A
+    @SuppressWarnings(%22unused%22)%0A
     priv
@@ -669,30 +669,49 @@
 G = 
-%22
 HTTP
-ContactsProvider%22
+BankingProvider.class.getSimpleName()
 ;%0A%0A 
@@ -721,16 +721,22 @@
 private 
+final 
 RestApi 
@@ -756,16 +756,22 @@
 private 
+final 
 CallWith
@@ -824,16 +824,22 @@
 rovider(
+final 
 RestApi 
@@ -1449,17 +1449,16 @@
 %0A    %7D%0A%0A
-%0A
     @Ove
@@ -1503,16 +1503,22 @@
 ontacts(
+final 
 Contact 
@@ -1547,19 +1547,66 @@
     
-return null
+throw new UnsupportedOperationException(%22Not implemented%22)
 ;%0A  

Clean up HTTPContactsProvider.java