@@ -0,0 +1,1630 @@
+package de.fau.amos.virtualledger.android.api.shared;%0A%0Aimport android.util.Log;%0A%0Aimport de.fau.amos.virtualledger.android.api.auth.AuthenticationProvider;%0Aimport io.reactivex.android.schedulers.AndroidSchedulers;%0Aimport io.reactivex.annotations.NonNull;%0Aimport io.reactivex.functions.Consumer;%0Aimport io.reactivex.schedulers.Schedulers;%0Aimport io.reactivex.subjects.PublishSubject;%0A%0Apublic class CallWithToken %7B%0A%0A    private static final String TAG = CallWithToken.class.getSimpleName();%0A%0A    final AuthenticationProvider authenticationProvider;%0A%0A    public CallWithToken(final AuthenticationProvider authenticationProvider) %7B%0A        this.authenticationProvider = authenticationProvider;%0A    %7D%0A%0A    public void callWithToken(final PublishSubject observable, final TokenCallback tokenCallback) %7B%0A        authenticationProvider.getToken()%0A                .subscribeOn(Schedulers.newThread())%0A                .observeOn(AndroidSchedulers.mainThread())%0A                .subscribe(new Consumer%3CString%3E() %7B%0A                    @Override%0A                    public void accept(@NonNull final String token) throws Exception %7B%0A                        tokenCallback.onReceiveToken(token);%0A                    %7D%0A                %7D, new Consumer%3CThrowable%3E() %7B%0A                    @Override%0A                    public void accept(@NonNull final Throwable throwable) throws Exception %7B%0A                        // did not get any token%0A                        Log.e(TAG, throwable.getMessage());%0A                        observable.onError(new Throwable(%22No authentication token available!%22));%0A                    %7D%0A                %7D);%0A%0A    %7D%0A%7D%0A

Add CallWithToken to avoid duplicate code for requests taht require token